X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FVariable%2FMagic.pm;h=1be2bf17906b14f84bc7515c8150a27098ba5a04;hb=3f061fdc6fe7977e19a17d0a67a161462bf147f2;hp=7f8cedbee93b09275233285f02f40d5b9f23e337;hpb=fceb925d08fa5e96cf477963195c3c4f6dbede65;p=perl%2Fmodules%2FVariable-Magic.git diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 7f8cedb..1be2bf1 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -11,13 +11,13 @@ Variable::Magic - Associate user-defined magic to variables from Perl. =head1 VERSION -Version 0.52 +Version 0.54 =cut our $VERSION; BEGIN { - $VERSION = '0.52'; + $VERSION = '0.54'; } =head1 SYNOPSIS @@ -88,7 +88,7 @@ You can safely apply different kinds of magics to the same variable, and each of Magic is type-agnostic. The same magic can be applied on scalars, arrays, hashes, subs or globs. -But the same hook (see below for a list) may trigger differently depending on the the type of the variable. +But the same hook (see below for a list) may trigger differently depending on the type of the variable. =item * @@ -152,7 +152,10 @@ It behaves roughly like Perl object destructors (i.e. C methods), excep I -This magic only applies to tied arrays and hashes, and fires when you try to access or change their elements. +When applied to tied arrays and hashes, this magic fires when you try to access or change their elements. + +Starting from perl 5.17.0, it can also be applied to closure prototypes, in which case the magic will be called when the prototype is cloned. +The L constant is true when your perl support this feature. =item * @@ -269,8 +272,11 @@ The callback is expected to return the new scalar or array length to use, or C -C<$_[2]> is a either an alias or a copy of the current key, and C<$_[3]> is an alias to the current element (i.e. the value). -Because C<$_[2]> might be a copy, it is useless to try to change it or cast magic on it. +When the variable for which the magic is invoked is an array or an hash, C<$_[2]> is a either an alias or a copy of the current key, and C<$_[3]> is an alias to the current element (i.e. the value). +Since C<$_[2]> might be a copy, it is useless to try to change it or cast magic on it. + +Starting from perl 5.17.0, this magic can also be called for code references. +In this case, C<$_[2]> is always C and C<$_[3]> is a reference to the cloned anonymous subroutine. =item * @@ -463,6 +469,10 @@ True for perls that call I magic when undefining magical arrays. True for perls that don't call I magic when you delete an element from a hash in void context. +=head2 C + +True for perls that call I magic when a magical closure prototype is cloned. + =head2 C True for perls that call I magic for operations on globs. @@ -646,6 +656,7 @@ our %EXPORT_TAGS = ( VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR VMG_COMPAT_HASH_DELETE_NOUVAR_VOID + VMG_COMPAT_CODE_COPY_CLONE VMG_COMPAT_GLOB_GET VMG_PERL_PATCHLEVEL VMG_THREADSAFE VMG_FORKSAFE @@ -671,12 +682,12 @@ L 5.8. A C compiler. This module may happen to build with a C++ compiler as well, but don't rely on it, as no guarantee is made in this regard. -L (core since perl 5), L (since 5.006). +L (core since perl 5), L (since 5.6.0). Copy tests need L (core since perl 5.005) and L (since 5.002). -Some uvar tests need L (since 5.009004). +Some uvar tests need L (since 5.9.4). Glob tests need L (since 5.002). -Threads tests need L and L (both since 5.007003). +Threads tests need L and L (both since 5.7.3). =head1 SEE ALSO @@ -705,7 +716,7 @@ Tests code coverage report is available at L