X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FVariable%2FMagic.pm;h=f60564917e14c139d3bfd9a8ae0d925d7b5c2b59;hb=refs%2Ftags%2Fv0.07_01;hp=d33c37b4d47e2b1a8666bfe5bdb7a7378ca3a50f;hpb=017450c5da83c82c9149b5170c757ce03679b9a9;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index d33c37b..f605649 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -1,5 +1,7 @@ package Variable::Magic; +use 5.007003; + use strict; use warnings; @@ -11,11 +13,15 @@ Variable::Magic - Associate user-defined magic to variables from Perl. =head1 VERSION -Version 0.05 +Version 0.07_01 =cut -our $VERSION = '0.05'; +use vars qw/$VERSION/; + +BEGIN { + $VERSION = '0.07_01'; +} =head1 SYNOPSIS @@ -94,13 +100,27 @@ The maximum integer used as a signature for user-defined magic. SIG_NBR = SIG_MAX - SIG_MIN + 1 +=head2 C + +True iff the 'copy' magic is available. + +=head2 C + +True iff the 'dup' magic is available. + +=head2 C + +True iff the 'local' magic is available. + =head1 FUNCTIONS =cut use XSLoader; -XSLoader::load __PACKAGE__, $VERSION; +BEGIN { + XSLoader::load __PACKAGE__, $VERSION; +} =head2 C @@ -134,7 +154,13 @@ Code references to corresponding magic callbacks. You don't have to specify all sub wizard { croak 'Wrong number of arguments for wizard()' if @_ % 2; my %opts = @_; - return _wizard(map { $opts{$_} } qw/sig get set len clear free data/); + my $sig = $opts{sig}; + my @types = qw/data get set len clear free/; + push @types, 'copy' if MGf_COPY; + push @types, 'dup' if MGf_DUP; + delete $opts{dup}; # don't use it for now + push @types, 'local' if MGf_LOCAL; + return _wizard($sig, map { $opts{$_} } @types); } =head2 C @@ -194,13 +220,15 @@ use base qw/Exporter/; our @EXPORT = (); our %EXPORT_TAGS = ( 'funcs' => [ qw/wizard gensig getsig cast getdata dispell/ ], - 'consts' => [ qw/SIG_MIN SIG_MAX SIG_NBR/ ] + 'consts' => [ qw/SIG_MIN SIG_MAX SIG_NBR MGf_COPY MGf_DUP MGf_LOCAL/ ] ); our @EXPORT_OK = map { @$_ } values %EXPORT_TAGS; $EXPORT_TAGS{'all'} = \@EXPORT_OK; =head1 DEPENDENCIES +L 5.7.3. + L (standard since perl 5), L (standard since perl 5.006). Glob tests need L (standard since perl 5.002).