summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-01-02 11:40:48 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-01-02 11:40:48 +0100
commiteffb3d11767a16df2fa0fbc159836c966b80ba88 (patch)
tree519ddbc17aad1caa6e35e913a48ebb7000aa41ef
parentb3ab6785f6871a84567168e1bd0426ff2f66d282 (diff)
downloadperl-effb3d11767a16df2fa0fbc159836c966b80ba88.tar.gz
Factorize numeric constant for "overloading" lexical hint
-rw-r--r--lib/overloading.pm10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/overloading.pm b/lib/overloading.pm
index 5f3b84ccee..e84708d656 100644
--- a/lib/overloading.pm
+++ b/lib/overloading.pm
@@ -5,6 +5,8 @@ use Carp ();
our $VERSION = '0.01';
+my $HINT_NO_AMAGIC = 0x01000000; # see perl.h
+
require 5.011000;
sub _ops_to_nums {
@@ -26,18 +28,18 @@ sub import {
if ( $^H{overloading} !~ /[^\0]/ ) {
delete $^H{overloading};
- $^H &= ~0x01000000;
+ $^H &= ~$HINT_NO_AMAGIC;
}
} else {
delete $^H{overloading};
- $^H &= ~0x01000000;
+ $^H &= ~$HINT_NO_AMAGIC;
}
}
sub unimport {
my ( $class, @ops ) = @_;
- if ( exists $^H{overloading} or not $^H & 0x01000000 ) {
+ if ( exists $^H{overloading} or not $^H & $HINT_NO_AMAGIC ) {
if ( @ops ) {
vec($^H{overloading} ||= '', $_, 1) = 1 for _ops_to_nums(@ops);
} else {
@@ -45,7 +47,7 @@ sub unimport {
}
}
- $^H |= 0x01000000;
+ $^H |= $HINT_NO_AMAGIC;
}
1;