summaryrefslogtreecommitdiffstats
path: root/contrib/perl5/lib/Tie/Scalar.pm
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/perl5/lib/Tie/Scalar.pm')
-rw-r--r--contrib/perl5/lib/Tie/Scalar.pm23
1 files changed, 12 insertions, 11 deletions
diff --git a/contrib/perl5/lib/Tie/Scalar.pm b/contrib/perl5/lib/Tie/Scalar.pm
index ef27dc1..0c67590 100644
--- a/contrib/perl5/lib/Tie/Scalar.pm
+++ b/contrib/perl5/lib/Tie/Scalar.pm
@@ -8,24 +8,24 @@ Tie::Scalar, Tie::StdScalar - base class definitions for tied scalars
package NewScalar;
require Tie::Scalar;
-
+
@ISA = (Tie::Scalar);
-
+
sub FETCH { ... } # Provide a needed method
sub TIESCALAR { ... } # Overrides inherited method
-
-
+
+
package NewStdScalar;
require Tie::Scalar;
-
+
@ISA = (Tie::StdScalar);
-
+
# All methods provided by default, so define only what needs be overridden
sub FETCH { ... }
-
-
+
+
package main;
-
+
tie $new_scalar, 'NewScalar';
tie $new_std_scalar, 'NewStdScalar';
@@ -79,6 +79,7 @@ process IDs with priority.
=cut
use Carp;
+use warnings::register;
sub new {
my $pkg = shift;
@@ -90,8 +91,8 @@ sub new {
sub TIESCALAR {
my $pkg = shift;
if (defined &{"{$pkg}::new"}) {
- carp "WARNING: calling ${pkg}->new since ${pkg}->TIESCALAR is missing"
- if $^W;
+ warnings::warn "WARNING: calling ${pkg}->new since ${pkg}->TIESCALAR is missing"
+ if warnings::enabled();
$pkg->new(@_);
}
else {
OpenPOWER on IntegriCloud