X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FVariable-Magic.git;a=blobdiff_plain;f=lib%2FVariable%2FMagic.pm;h=47ed91a7577769e62c72ef9304902d2a657252e3;hp=2fe47c920388b748a0e41f74f87ddf6ec956c190;hb=a924275b5f3d7c1c612add18c8bf7a6f358e703f;hpb=d28712f92da321bedadbf8b4eb9c27fcd4205ab8 diff --git a/lib/Variable/Magic.pm b/lib/Variable/Magic.pm index 2fe47c9..47ed91a 100644 --- a/lib/Variable/Magic.pm +++ b/lib/Variable/Magic.pm @@ -127,10 +127,13 @@ It is called for array subscripts and slices, but never for hashes. I -This magic only applies to scalars and arrays, and is triggered when the 'size' or the 'length' of the variable has to be known by Perl. +This magic only applies to arrays (though it used to also apply to scalars), and is triggered when the 'size' or the 'length' of the variable has to be known by Perl. This is typically the magic involved when an array is evaluated in scalar context, but also on array assignment and loops (C, C or C). The length is returned from the callback as an integer. +Starting from perl 5.12, this magic is no longer called by the C keyword, and starting from perl 5.17.4 it is also no longer called for scalars in any situation, making this magic only meaningful on arrays. +You can use the constants L and L to see if this magic is available for scalars or not. + =item * I @@ -434,6 +437,11 @@ Initial L capability was introduced in perl 5.9.5, with a fully funct True for perls that don't call I magic when taking the C of a magical scalar. +=head2 C + +True for perls that don't call I magic on scalars. +Implies L. + =head2 C True for perls that don't call I magic when you push an element in a magical array. @@ -633,6 +641,7 @@ our %EXPORT_TAGS = ( 'consts' => [ qw< MGf_COPY MGf_DUP MGf_LOCAL VMG_UVAR VMG_COMPAT_SCALAR_LENGTH_NOLEN + VMG_COMPAT_SCALAR_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID VMG_COMPAT_ARRAY_UNSHIFT_NOLEN_VOID VMG_COMPAT_ARRAY_UNDEF_CLEAR