diff options
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm')
-rw-r--r-- | systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm index 30f810b0a1..8a5eeb8df8 100644 --- a/systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm +++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/overload.pm @@ -1,8 +1,11 @@ package overload; -our $VERSION = '1.31'; +use strict; +no strict 'refs'; -%ops = ( +our $VERSION = '1.33'; + +our %ops = ( with_assign => "+ - * / % ** << >> x .", assign => "+= -= *= /= %= **= <<= >>= x= .=", num_comparison => "< <= > >= == !=", @@ -26,7 +29,7 @@ my %ops_seen; sub nil {} sub OVERLOAD { - $package = shift; + my $package = shift; my %arg = @_; my $sub; *{$package . "::(("} = \&nil; # Make it findable via fetchmethod. @@ -51,14 +54,14 @@ sub OVERLOAD { } sub import { - $package = (caller())[0]; + my $package = (caller())[0]; # *{$package . "::OVERLOAD"} = \&OVERLOAD; shift; $package->overload::OVERLOAD(@_); } sub unimport { - $package = (caller())[0]; + my $package = (caller())[0]; shift; *{$package . "::(("} = \&nil; for (@_) { @@ -131,7 +134,7 @@ sub mycan { # Real can would leave stubs. return undef; } -%constants = ( +my %constants = ( 'integer' => 0x1000, # HINT_NEW_INTEGER 'float' => 0x2000, # HINT_NEW_FLOAT 'binary' => 0x4000, # HINT_NEW_BINARY @@ -1239,7 +1242,7 @@ Put this in F<symbolic.pm> in your Perl library directory: This module is very unusual as overloaded modules go: it does not provide any usual overloaded operators, instead it provides an -implementation for L</C<nomethod>>. In this example the C<nomethod> +implementation for C<L</nomethod>>. In this example the C<nomethod> subroutine returns an object which encapsulates operations done over the objects: C<< symbolic->new(3) >> contains C<['n', 3]>, C<< 2 + symbolic->new(3) >> contains C<['+', 2, ['n', 3]]>. |