summaryrefslogtreecommitdiff
path: root/lib/vars.pm
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>2000-03-13 11:09:05 +0000
committerGurusamy Sarathy <gsar@cpan.org>2000-03-13 11:09:05 +0000
commitd3a7d8c7d7e4d69d7d81e4e3e900ec57f07ca07c (patch)
tree46e26336d8cdf0e9f503f5650660a4aafcc09411 /lib/vars.pm
parentd16e9ed98812a2e69b435f9514ff8e38e7ff38ad (diff)
downloadperl-d3a7d8c7d7e4d69d7d81e4e3e900ec57f07ca07c.tar.gz
final touches for lexical warnings (from Paul Marquess)
p4raw-id: //depot/perl@5702
Diffstat (limited to 'lib/vars.pm')
-rw-r--r--lib/vars.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/vars.pm b/lib/vars.pm
index 6ae5373f89..bde0b2a0e8 100644
--- a/lib/vars.pm
+++ b/lib/vars.pm
@@ -8,6 +8,7 @@ require 5.002;
# if Carp hasn't been loaded in earlier compile time. :-(
# We'll let those bugs get found on the development track.
require Carp if $] < 5.00450;
+use warnings::register();
sub import {
my $callpack = caller;
@@ -22,9 +23,8 @@ sub import {
} elsif ($sym =~ /^\w+[[{].*[]}]$/) {
require Carp;
Carp::croak("Can't declare individual elements of hash or array");
- } elsif ($^W and length($sym) == 1 and $sym !~ tr/a-zA-Z//) {
- require Carp;
- Carp::carp("No need to declare built-in vars");
+ } elsif (warnings::enabled() and length($sym) == 1 and $sym !~ tr/a-zA-Z//) {
+ warnings::warn("No need to declare built-in vars");
}
}
*{"${callpack}::$sym"} =