summaryrefslogtreecommitdiff
path: root/lib/constant.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/constant.pm
parentd16e9ed98812a2e69b435f9514ff8e38e7ff38ad (diff)
downloadperl-d3a7d8c7d7e4d69d7d81e4e3e900ec57f07ca07c.tar.gz
final touches for lexical warnings (from Paul Marquess)
p4raw-id: //depot/perl@5702
Diffstat (limited to 'lib/constant.pm')
-rw-r--r--lib/constant.pm12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/constant.pm b/lib/constant.pm
index b4fcd421ac..72ad793653 100644
--- a/lib/constant.pm
+++ b/lib/constant.pm
@@ -2,9 +2,10 @@ package constant;
use strict;
use 5.005_64;
+use warnings::register;
our($VERSION, %declared);
-$VERSION = '1.01';
+$VERSION = '1.02';
#=======================================================================
@@ -51,18 +52,17 @@ sub import {
# Maybe the name is tolerable
} elsif ($name =~ /^[A-Za-z_]\w*\z/) {
# Then we'll warn only if you've asked for warnings
- if ($^W) {
- require Carp;
+ if (warnings::enabled()) {
if ($keywords{$name}) {
- Carp::carp("Constant name '$name' is a Perl keyword");
+ warnings::warn("Constant name '$name' is a Perl keyword");
} elsif ($forced_into_main{$name}) {
- Carp::carp("Constant name '$name' is " .
+ warnings::warn("Constant name '$name' is " .
"forced into package main::");
} else {
# Catch-all - what did I miss? If you get this error,
# please let me know what your constant's name was.
# Write to <rootbeer@redcat.com>. Thanks!
- Carp::carp("Constant name '$name' has unknown problems");
+ warnings::warn("Constant name '$name' has unknown problems");
}
}