Revision history for Variable-Magic 0.64 2024-03-18 23:20 UTC This is a maintenance release. The code contains no functional change. Satisfied users of version 0.63 can skip this update. + Add : Contributing guidelines are now listed in the new CONTRIBUTING file. + Fix : [RT #151104] : fix for t/18-opinfo.t broken under blead Some optimization in core made t/18-opinfo.t fail since perl 5.39.7, but that was reverted before 5.40 was released. This fix will make this test pass even when the optimization is reinstantiated after release freeze. Thanks David Mitchell for reporting and providing a fix. 0.63 2022-09-20 21:45 UTC This is a maintenance release. The code contains no functional change. Satisfied users of version 0.62 can skip this update. + Fix : [RT #144052] : Add support for 5.37.3s PADSV_STORE optimization B.pm-related tests have been taught about this new thing. Thanks Richard Leach for contributing a patch. + Upd : Contact info. 0.62 2017-11-04 16:35 UTC + Fix : [RT #123314] : Compatibility with CV-in-stash optimisation Thanks Father Chrysostomos for reporting and contributing a patch. 0.61 2017-01-24 15:30 UTC + Fix : [RT #115792] : Latest blead stack unwind work causes infloop in a test. A change in how the core frees temporary values after eval interacted badly with Variable::Magic and caused infinite loops when a free callback was attached to a wizard. This change was temporarily reverted, but is going to be reinstated, and Variable::Magic is now able to play nicely when this happens. Thanks Peter Rabbitson for reporting and David Mitchell for providing a fix. 0.60 2016-09-06 22:30 UTC + Chg : A large chunk of boilerplate XS code, which is also used in other XS modules, has been factored out of the main .xs file to a collection of .h files in the xsh subdirectory. + Fix : [RT #128989] : Bleadperl v5.25.3-266-g1d7e644 breaks V::M. Len magic is no longer called for negative array indices fetches, so the relevant tests are now skipped. Thanks Andreas Koenig for reporting. 0.59 2015-10-05 19:05 UTC + Chg : The magic callbacks are now always executed in a new stack. This should have no negative impact (performance-wise or behaviour-wise) on your code, but may actually fix some obscure bugs. + Fix : [RT #107294] : Crash during install of Variable-Magic-0.58 running "t\18-opinfo.t". A recent change in the core implementation of transliterations caused an undefined behaviour when it interacted with this module, which resulted in visible stack corruption on Win32 perls compiled with MSVC when the op_info feature was enabled. This was fixed by using a separate stack for the magic callbacks. Thanks Peter Stokes for reporting and providing greatly helpful feedback. + Fix : The object op_info feature will now handle correctly Unicode transliteration, multideref and custom ops. 0.58 2015-07-21 16:00 UTC + Add : If a non-len magic callback returns a reference, it will now only be freed at the end of the statement that caused the magic to trigger. This allows the user to attach free magic (or a plain destructor) to a token returned from the callbacks in order to defer an action after the magic is processed by perl. + Fix : Test failures of threads tests on systems with harsh resource constraints causing the threads to exit() during run. 0.57 2015-04-17 15:20 UTC + Chg : The new environment variable to enable thread tests on older perls is PERL_FORCE_TEST_THREADS. Note that this variable should only be turned on by authors. + Fix : Segfaults when the module is loaded by several threads (or Windows emulated processes) ran in parallel. + Fix : Segfaults when the module is loaded in a thread, which spawns itself a new thread, and that child thread outlives its parent. + Fix : Small memory leaks of structures required for thread safety. + Fix : Update the Windows ActivePerl + gcc 3.4 workaround for ExtUtils::MakeMaker 7.04. Thanks Christian Walde for reporting and feedback on this issue. + Tst : The global destruction test will now be exercised on any perl that has DEBUGGING set. + Tst : Optional capturing tests in t/17-ctl.t that were only run when Capture::Tiny was present were converted to an IPC::Open3 based helper and will now be run everywhere. 0.56 2015-03-11 15:15 UTC + Fix : [RT #101410] : Install fails in blead Even though the change that caused this error was reverted from blead, lvalue uses of ERRSV have been removed from this module so that there will be no breakage when this change is possibly reintroduced in the following months. Thanks Dave Rolsky for reporting. + Tst : $ENV{$Config{ldlibpthname}} is now preserved on all platforms, which will address failures of t/17-ctl.t with unusual compilers (like icc) that link all their compiled objects to their own libraries. + Tst : The global destruction test is now only run on perl 5.13.4 and higher, and only if either Perl::Destruct::Level is installed or PERL_DESTRUCT_LEVEL is set and the perl is a debugging perl. This will solve rare crashes of t/15-self.t on perl 5.13.3 and older. 0.55 2014-10-20 23:45 UTC + Fix : [RT #99319] : t/18-opinfo.t: test failure due to change in perl 5 blead The new METHOP op class added in perl 5.21.5 is now supported. Thanks James E Keenan for reporting. 0.54 2014-09-22 17:30 UTC + Add : The new constant VMG_COMPAT_CODE_COPY_CLONE evaluates to true if your perl calls 'copy' magic when a magical code prototype is cloned, which is currently the case for perl 5.17.0 and above. + Fix : [RT #90205] : copy magic on subs puts raw CV in $_[3] $_[3] will now contain a reference to the cloned code when 'copy' magic is called for a coderef. Thanks Lukas Mai for reporting. + Fix : t/35-stash.t has been taught about perl 5.21.4. + Fix : Tests using run_perl() in t/17-ctl.t will no longer fail on Android. 0.53 2013-09-01 17:50 UTC This is a maintenance release. The code contains no functional change. Satisfied users of version 0.52 can skip this update. + Fix : [RT #86338] : typo fix. Thanks dsteinbrunner@pobox.com for the patch. + Tst : Author tests are no longer bundled with this distribution. They are only made available to authors in the git repository. 0.52 2012-11-05 02:30 UTC + Add : The new constant VMG_COMPAT_SCALAR_NOLEN evaluates to true when your perl does not call 'len' magic for scalars, which is the case for perl 5.17.4 and above. This fixes RT #80388. + Tst : t/35-stash.t has been taught about perl 5.17.4. + Tst : Author tests overhaul. 0.51 2012-08-18 15:00 UTC + Fix : It is now safe to call dispell() from inside 'free', 'copy' and 'uvar' callbacks to dispell the magic currently in use. Thanks Clinton Gormley for reporting. + Fix : Exceptions thrown from inside a 'free' callback are now always consistently propagated outside of the callback. They used to be lost when the 'free' callback was invoked at the end of an eval block or string. + Fix : The 'reset RMG flag' workaroundn used to allow wizards with both 'uvar' and 'clear' magics to be cast onto a hash, has been made thread-safe. 0.50 2012-06-24 23:00 UTC + Fix : Less memory is leaked when a wizard is freed during global destruction, or when an exception is thrown from a 'free' callback. + Fix : [RT #77991] : t/17-ctl.t fails on perl 5.14 and 5.16. This was actually an issue with ActivePerl, and this test has learned to cope with it. Thanks Gisle Aas for reporting. + Tst : t/35-stash.t has been taught about perl 5.17.1. + Doc : Many clarifications. 0.49 2012-06-05 21:40 UTC This is a maintenance release. The code contains no functional change. Satisfied users of version 0.48 can skip this update. + Fix : [RT #77644] : t/17_ctl.t fails in test 44 since 5.17.0. This test has been taught about perl 5.17.0. Thanks Reini Urban for reporting. + Tst : t/99-kwalitee.t will be skipped when only problematic versions of its dependencies are available. 0.48 2012-02-17 23:40 UTC + Add : You can now pass a reference to undef as the magic callback in order to install a no-op callback. Thanks Florian Ragwitz for the suggestion. 0.47 2011-10-27 16:55 UTC + Add : The new constant VMG_COMPAT_HASH_DELETE_NOUVAR_VOID evaluates to true when "delete $hash{key}" does not call 'delete' uvar magic in void context. + Chg : The MAGIC tokens created by this module no longer use the mg_private member for storing a "magical" signature. + Fix : Triggering magic in a thread on a variable cloned from the main interpreter, and when the wizard already went out of scope, will not segfault anymore. + Opt : The pointer table is no longer needed to ensure thread safety. The size of the object code is about 8% smaller for threaded perls. + Tst : Threads tests will not fail anymore if resources constraints prevent the system from creating all the required threads. 0.46 2011-01-23 16:45 UTC + Fix : [RT #64866] : Assertion failure with perl 5.13.9. The real problem was that dispell() wasn't properly resetting the magical sv flags, which became visible in the test suite only with perl 5.13.9. Thanks Joshua ben Jore for reporting. 0.45 2010-11-21 23:15 UTC This is a maintenance release. The code contains no functional change. Users of 0.44 can skip this update. + Doc : C++ compilers are officially NOT supported. + Doc : The minimum perl 5.10.0 requirement for uvar magic has been made more explicit. Thanks Peter Rabbitson for pointing this out and contributing a patch. + Tst : Tune for perl 5.13.7. + Tst : Capture::Tiny will be used in t/17-ctl.t if and only if it can capture a simple run. 0.44 2010-09-24 19:10 UTC + Fix : Broken linkage on Windows with gcc 3.4, which appears in particular when using ActivePerl's default compiler suite. For those setups, the Variable::Magic shared library will now be linked against the perl dll directly (instead of the import library). This (should) fix RT #51483. Thanks Christian Walde for helping to reproduce this failure and extra testing. + Rem : Support for development perls from the 5.11 branch but older than the 5.11.0 release was removed. This could cause more recent setups to fail. + Tst : Threads tests are now only run on perl 5.13.4 and higher. They could segfault randomly because of what seems to be an internal bug of Perl, which has been addressed in 5.13.4. There is also an environment variable that allows you to forcefully run those tests, but it should be set only for author testing and not for end users. 0.43 2010-06-25 23:35 UTC + Add : The new constant VMG_COMPAT_GLOB_GET tells you whether get magic is called for globs. It's true starting perl 5.13.2. + Chg : All callbacks are now called within an eval-like context. Only free callbacks used to be called that way. + Fix : Some exceptions thrown from a free callback could be lost. + Fix : Croak messages could sometimes be repeated several times. + Fix : t/41-clone.t segfaulting with perl 5.13.2. 0.42 2010-05-19 00:15 UTC This is a maintenance release. The code contains no functional change. Users of 0.41 can skip this update. + Fix : Test failures with perl 5.13. + Tst : Improve coverage. 0.41 2010-03-15 17:35 UTC + Doc : Tweaks and fixups. Thanks Shlomi Fish. + Fix : Compatibility with the soon-to-be-released perl 5.12.0. + Fix : Correctly propagate the errors thrown when variable destruction happens at compile-time and not from inside eval STRING. Thanks Florian Ragwitz and Ash Berlin for reporting. 0.40 2010-01-06 23:20 UTC + Fix : Possible memory miswrites when passing data arguments to cast(). + Fix : Minor C portability tweaks. 0.39 2009-12-01 00:05 UTC + Add : You can use a function name as a callback by passing a string reference to wizard() instead of a code reference. + Fix : Compatiblity with perl 5.11.1 and 5.11.2. + Fix : Scalars stored into the data slot no longer leak. + Fix : Thread destruction should not segfault anymore. + Opt : As a result of removing the deprecated features, less memory is used for both threaded (a pointer table is used instead of a hash) and non-threaded (no global structure is needed anymore) perls. + Rem : As advertised in the precendent version, all the signature related features were removed. This includes the 'sig' option to wizard(), the getsig() and gensig() functions, and the SIG_* constants. 0.38 2009-10-04 16:10 UTC + Dep : All the signature-related features are DEPRECATED and will be removed in december 2009. This includes the 'sig' option to wizard(), the getsig() and gensig() functions, and the SIG_* constants. Afaik those features were never used in real life, and they make the XS code slow and brittle. If you want your wizards to be globally available, you'll have to handle that yourself by storing them in a hash. + Doc : More examples in a new COOKBOOK section. + Fix : Compatiblity with the 5.11.0 release. The new compatibility constant VMG_COMPAT_ARRAY_PUSH_NOLEN_VOID was added to cover this. + Fix : Work around Kwalitee test misfailures. 0.37 2009-08-25 15:25 UTC + Add : The new constant VMG_FORKSAFE can be tested to know whether the module will behave nicely when fork()ing. It's currently always true except on Windows where you need perl 5.10.1 for it to be true. + Doc : Nits and clarifications. 0.36 2009-07-05 16:30 UTC + Chg : getdata() now returns an empty list when no magic is present. It used to return undef but did not croak as stated in the doc. Thanks Matt S. Trout for pointing this out. + Fix : Building and tests with ActiveState Perl 5.8 build >= 822. 0.35 2009-05-15 20:50 UTC This is a maintenance release. Users of 0.34 can skip this update. + Chg : uvar magic used to be enabled for 5.9.5. It now requires 5.10 or later. + Fix : Silence compilation warnings for cxinc(). + Rem : The workaround introduced in 0.31 for the "Unknown errors" issue was removed, as regression tests show that 0.34 provides a better fix. + Tst : Skip t/40-threads.t on 5.8.x with old versions of threads and threads::shared. 0.34 2009-04-19 16:55 UTC + Fix : Destruction of wizards in require. + Fix : "panic: restartop" in 5.10 when dieing at compile time triggers a destructor. 0.33 2009-03-26 00:00 UTC + Chg : cast() and getsig() now croak too when an invalid signature is passed. + Fix : It was possible to generate with gensig() the same signature twice before actually defining the wizards. + Tst : More stash tests. + Tst : Test when the magic takes place in some cases. + Tst : Improved coverage for the op object feature. 0.32 2009-03-01 13:45 UTC + Chg : dispell() and getdata() now croak when an invalid signature is passed. + Doc : More examples and a brand new synopsis. + Fix : The signature is no longer stored in the mg_private member of the MAGIC struct. This fixes possible clashes with magics from other extensions. + Fix : op info objects weren't blessed into the right class. + Fix : Races when initializing the op names cache under threads. 0.31 2009-02-19 23:50 UTC + Doc : A somewhat better introduction. The FUNCTION section was moved before CONSTANTS and HISTORY since it's more important. And 'assignation' is really 'assignment', says Ricardo. :) + Fix : The op_info features are now thread safe. + Fix : Segfaults that occured when trying to get the op name during global destruction. + Fix : Segfaults and wrong "Unknown error" exceptions that happened when dieing in require caused a free callback to fire. Thanks Florian Ragwitz for reporting. 0.30 2009-02-12 17:05 UTC + Add : You can now get in all the callbacks either the name or a B::OP object representing the current op if you pass the new 'op_info' option to wizard() with respective values VMG_OP_INFO_NAME and VMG_OP_INFO_OBJECT. + Doc : Document magic on array/hashes values. + Fix : Completely skip free callbacks during global destruction. + Tst : Tests now pass again on 5.8.3 and lower (they were broken since 0.27). + Tst : Test magic on symbol table and on array/hash values. 0.29 2009-02-08 11:10 UTC + Add : Set $_[2] to the default length for len magic on scalars. + Chg : Perl 5.8 is required. + Chg : The CLONE method will no longer be defined for non-threaded perls. + Doc : Nits. + Fix : The logic for turning off the GMAGICAL flag on hashes when no uvar magic is involved could do nasty things on tied hashes. + Upd : More resources in META.yml. 0.28 2009-01-24 17:05 UTC + Add : The 'copy_key' option to wizard(), that enables the safe edition of $_[2] in uvar callbacks to redirect actions to another key. + Fix : Exception objects thrown from callbacks at compile time were not available in $@. + Fix : free callbacks triggered during global destruction could lead to segfaults because the wizard was already freed. + Fix : Refcount of scalars with free callback. + Fix : Segfaults when using get or uvar magic simultaneously with clear magic. + Doc : The documentation about what the callbacks take and should return is now somewhat clearer. 0.27 2009-01-18 23:40 UTC + Fix : Offset of 1 with len magic on scalars. + Fix : Segfaults that seem to happen when one croak in a callback at compile time (thanks Ash Berlin for the testcase). + Upd : Resources in META.yml (Florian Ragwitz) + Tst : Large cleanup resulting in a wider set of tested behaviours. 0.26 2008-11-29 22:05 UTC + Fix : Leaks of cloned coderefs that access lexicals. + Fix : Building with maint-5.8 and blead (thanks Andreas Koenig). 0.25 2008-11-12 19:40 UTC + Fix : Compatibility with 5.8.9. + Fix : Old Pod::Coverage don't ignore CLONE. + Upd : META.yml spec updated to 1.4. 0.24 2008-10-12 14:55 UTC + Fix : Really fix it. 0.23 2008-10-11 17:25 UTC + Fix : Building on perls with multiplicity but not ithreads. 0.22 2008-09-29 19:40 UTC + Doc : Explain how magic differs from overloading. + Fix : Disable thread safety for perl 5.8 on Windows. If you want it enabled, reliable feedback is welcome. 0.21_02 2008-09-28 23:10 UTC + Fix : Hide previously deleted magic tokens in vmg_svt_free (Yuval Kogman). 0.21_01 2008-09-22 13:25 UTC + Chg : Shrink the context data. + Fix : Enable thread safety features for perls that just lack MY_CXT_CLONE. + Tst : Output threads and threads::shared versions in threads tests. 0.20 2008-09-20 23:35 UTC + Fix : The module is now thread safe. You can test if it had been built with thread safety features enabled through the VMG_THREADSAFE constant. + Fix : Correct backtrace when wizard() croaks. + Fix : 'cast $a, undef' should throw an 'invalid wizard' error instead of an 'invalid signature'. 0.19 2008-07-05 15:05 UTC + Add : The patchlevel with which the module has been built is now exported with the VMG_PERL_PATCHLEVEL constant. + Chg : Version checking macros overhaul. + Fix : 'uvar' magic should only be enabled in maint-5.10 and higher since it's never going to be backported to 5.8. + Fix : Likewise, the copy callback API change should only be enabled in 5.11 and higher. + Fix : Instead of those ackward fake refcount increments in the wizard destructor, flag the wizard with SVf_BREAK and force temps cleanup. This should fix the wizard destruction for all perls, and solves the leak introduced by the previous solution. 0.18 2008-07-04 12:20 UTC + Fix : Enable uvar magic when patchlevel >= 28419. + Fix : Set VMG_COMPAT_ARRAY_PUSH_NOLEN for Windows ActiveState Perl 5.8.x. 0.17 2008-05-11 09:05 UTC + Fix : 5.8.4 and lower don't have mPUSHi. Gah. Yeah, I know, I should use Devel::PPPort. 0.16 2008-05-10 22:05 UTC + Add : The samples/copy.pl script. + Chg : The sv_magical() + vmg_mg_magical() combo was simplified into vmg_sv_magicuvar(). + Tst : t/33-code.t was testing scalars, not code. + Tst : is() and like() are better than ok(). + Tst : 100% coverage reached. 0.15 2008-04-11 18:25 UTC + Chg : Factor vmg_cb_call{1,2,3}() into one function. + Fix : len magic is no longer called when taking the length() of a magical scalar since p32969. The VMG_COMPAT_SCALAR_LENGTH_NOLEN constant was added to cover this. + Tst : More tests for t/22-len.t. 0.14 2008-03-24 12:35 UTC + Fix : t/16-huf.t failures on Solaris and FreeBSD caused by not updating mg->mg_ptr after Renew-ing it on dispell. + Fix : Undefining MGf_DUP caused the wizard's magic to be wrongly initialized. MGf_DUP now appears as true from the user point of view, but the dup callback isn't actually set. + Fix : Warnings with blead due to copy callbacks now taking an I32 (API change #33256). + Fix : vmg_svt_val() and vmg_uvar_del() aren't required if no uvar magic is available. + Tst : Tests now output the version of optional modules loaded. 0.13 2008-03-19 14:35 UTC + Doc : Link to coverage report. + Fix : Correct dependencies listing in META.yml. + Tst : Improved test coverage. + Tst : Print the patchlevel as a comment. + Tst : Use is() where it's relevant. + Tst : t/16-huf.t now really tests interaction with H::U::FH. 0.12 2008-02-07 18:15 UTC + Fix : POD error. Thanks to Chris Williams (BinGOs) for the quick feedback. 0.11 2008-02-07 17:55 UTC + Add : Copy callbacks now receive the current key/index in $_[2]. The current value/element is now in $_[3]. + Chg : The trigger of copy magic on list assignment with perls greater than 5.10.0 was caused by uvar magic. Hence, VMG_COMPAT_HASH_LISTASSIGN_COPY was removed. Use VMG_UVAR instead. + Fix : Build failures on patched perls. + Tst : Added missing exported symbols to 01-import.t. 0.10 2008-02-04 11:30 UTC + Add : New script : samples/vm_vs_tie.pl, that benchmarks our uvar magic versus tied hashes. + Add : The VMG_COMPAT_* constants can be used from userspace to check perl magic abilities. + Fix : Callbacks that returned undef made us croak, breaking the variable behaviour (regression test in 14-callbacks.t). + Fix : uvar callbacks weren't tested for non-NULL-ity before being called (regression test in 28-uvar.t). + Tst : Fix typo in 25-copy.t that prevented Tie::Hash tests to be ran. 0.09 2008-02-02 11:30 UTC + Doc : Explicitely say that uvar callbacks are safely ignored for non-hashes. + Doc : Document caveats and fix the usual set of typos. + Fix : vmg_dispell() didn't check if the ext magic were ours when counting wizards that have uvar callbacks, resulting in a possible memory misread. + Fix : getdata() now returns directly the data object, and no longer a copy. This caused a leak. + Tst : Prefix author tests by 9*-. + Tst : New optional author test : 95-portability-files.t, that uses Test::Portability::Files when it's present. + Tst : New test : 14-self.t, that tests application of magic on the wizard itself. + Tst : Move Hash::Util::FieldHash tests out of 11-multiple.t to 15-huf.t. 0.08 2008-02-01 16:55 UTC + Add : copy magic for tied arrays/hashes. + Add : local magic. + Add : uvar magics : fetch, store, exists, delete for hashes. 0.07_* 2008-01 Internal development versions. 0.06 2007-11-20 10:10 UTC + Chg : 5.7.3 is now officially required. + Fix : "data" test failures on 5.8.{0,2}. + Fix : Drand01() vs rand(). 0.05 2007-11-19 09:10 UTC + Fix : 5.10.0_RC1 compatibility fix. 0.04 2007-08-28 12:25 UTC + Chg : s/require (XSLoader)/use $1/. + Fix : Tests are now strict. + Fix : Complete dependencies. 0.03 2007-08-01 17:20 UTC + Add : Passing the signature of an already defined magic to wizard() now returns the corresponding magic object. + Add : You can pass the numeric signature as the wizard argument of cast(), dispell() and getdata(). + Add : Any argument specified after the wizard (or the signature) in a call to cast() is now passed to the private data constructor in $_[1] and after. + Chg : $_[0] is now always a reference to the magic variable in all callbacks. The reason for changing from the previous behaviour is that one may want to apply the same magic to a plain scalar and to a scalar reference, and needs a way to distinguish between them in the callback (say, ref()). + Fix : Wizard object destruction used not to free the signature. 0.02 2007-07-27 13:50 UTC + Fix : In response to test report 548152 : Newx() and SvMAGIC_set() not present on older perls. + Fix : In response to test report 548275 : Since perl 5.9.5, 'clear' magic is invoked when an array is undefined (bug #43357). Moreover, 'len' magic is no longer called by pushing an element since perl 5.9.3. + Fix : Missing glob test in MANIFEST. 0.01 2007-07-25 16:15 UTC First version, released on an unsuspecting world.