Hello community, here is the log from the commit of package perl-Variable-Magic for openSUSE:Factory checked in at 2015-04-16 14:13:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Variable-Magic (Old) and /work/SRC/openSUSE:Factory/.perl-Variable-Magic.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Variable-Magic" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Variable-Magic/perl-Variable-Magic.changes 2013-10-06 14:56:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Variable-Magic.new/perl-Variable-Magic.changes 2015-04-16 14:13:44.000000000 +0200 @@ -1,0 +2,42 @@ +Tue Apr 14 19:30:06 UTC 2015 - co...@suse.com + +- updated to 0.56 + see /usr/share/doc/packages/perl-Variable-Magic/Changes + + 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. + +------------------------------------------------------------------- Old: ---- Variable-Magic-0.53.tar.gz New: ---- Variable-Magic-0.56.tar.gz cpanspec.yml ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Variable-Magic.spec ++++++ --- /var/tmp/diff_new_pack.ddbcMx/_old 2015-04-16 14:13:45.000000000 +0200 +++ /var/tmp/diff_new_pack.ddbcMx/_new 2015-04-16 14:13:45.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package perl-Variable-Magic # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,26 +17,18 @@ Name: perl-Variable-Magic -Version: 0.53 +Version: 0.56 Release: 0 %define cpan_name Variable-Magic Summary: Associate user-defined magic to variables from Perl License: Artistic-1.0 or GPL-1.0+ Group: Development/Libraries/Perl Url: http://search.cpan.org/dist/Variable-Magic/ -Source: http://www.cpan.org/authors/id/V/VP/VPIT/%{cpan_name}-%{version}.tar.gz +Source0: http://www.cpan.org/authors/id/V/VP/VPIT/%{cpan_name}-%{version}.tar.gz +Source1: cpanspec.yml BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: perl BuildRequires: perl-macros -#BuildRequires: perl(ActivePerl) -#BuildRequires: perl(Capture::Tiny) >= 0.08 -#BuildRequires: perl(Perl::Destruct::Level) -#BuildRequires: perl(Variable::Magic) -#BuildRequires: perl(Variable::Magic::TestGlobalDestruction) -#BuildRequires: perl(Variable::Magic::TestThreads) -#BuildRequires: perl(Variable::Magic::TestValue) -#BuildRequires: perl(Variable::Magic::TestWatcher) -#BuildRequires: perl(VPIT::TestHelpers) %{perl_requires} %description @@ -70,6 +62,6 @@ %files -f %{name}.files %defattr(-,root,root,755) -%doc Changes README +%doc Changes README samples %changelog ++++++ Variable-Magic-0.53.tar.gz -> Variable-Magic-0.56.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/Changes new/Variable-Magic-0.56/Changes --- old/Variable-Magic-0.53/Changes 2013-09-01 19:41:25.000000000 +0200 +++ new/Variable-Magic-0.56/Changes 2015-03-11 16:03:54.000000000 +0100 @@ -1,5 +1,41 @@ Revision history for Variable-Magic +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. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/META.json new/Variable-Magic-0.56/META.json --- old/Variable-Magic-0.53/META.json 2013-09-01 19:43:04.000000000 +0200 +++ new/Variable-Magic-0.56/META.json 2015-03-11 16:04:00.000000000 +0100 @@ -4,7 +4,7 @@ "Vincent Pit <p...@profvince.com>" ], "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921", + "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", "license" : [ "perl_5" ], @@ -28,7 +28,8 @@ "ExtUtils::MakeMaker" : "0", "Test::More" : "0", "XSLoader" : "0", - "base" : "0" + "base" : "0", + "lib" : "0" } }, "configure" : { @@ -60,5 +61,5 @@ "url" : "http://git.profvince.com/?p=perl%2Fmodules%2FVariable-Magic.git" } }, - "version" : "0.53" + "version" : "0.56" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/META.yml new/Variable-Magic-0.56/META.yml --- old/Variable-Magic-0.53/META.yml 2013-09-01 19:43:04.000000000 +0200 +++ new/Variable-Magic-0.56/META.yml 2015-03-11 16:04:00.000000000 +0100 @@ -3,36 +3,37 @@ author: - 'Vincent Pit <p...@profvince.com>' build_requires: - Carp: 0 - Config: 0 - Exporter: 0 - ExtUtils::MakeMaker: 0 - Test::More: 0 - XSLoader: 0 - base: 0 + Carp: '0' + Config: '0' + Exporter: '0' + ExtUtils::MakeMaker: '0' + Test::More: '0' + XSLoader: '0' + base: '0' + lib: '0' configure_requires: - Config: 0 - ExtUtils::MakeMaker: 0 + Config: '0' + ExtUtils::MakeMaker: '0' dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 6.66, CPAN::Meta::Converter version 2.120921' +generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' license: perl meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html - version: 1.4 + version: '1.4' name: Variable-Magic no_index: directory: - t - inc requires: - Carp: 0 - Exporter: 0 - XSLoader: 0 - base: 0 - perl: 5.008 + Carp: '0' + Exporter: '0' + XSLoader: '0' + base: '0' + perl: '5.008' resources: bugtracker: http://rt.cpan.org/Dist/Display.html?Name=Variable-Magic homepage: http://search.cpan.org/dist/Variable-Magic/ license: http://dev.perl.org/licenses/ repository: http://git.profvince.com/?p=perl%2Fmodules%2FVariable-Magic.git -version: 0.53 +version: '0.56' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/Magic.xs new/Variable-Magic-0.56/Magic.xs --- old/Variable-Magic-0.53/Magic.xs 2013-06-03 15:19:02.000000000 +0200 +++ new/Variable-Magic-0.56/Magic.xs 2015-03-11 02:29:46.000000000 +0100 @@ -187,6 +187,12 @@ # define VMG_COMPAT_HASH_DELETE_NOUVAR_VOID 0 #endif +#if VMG_HAS_PERL(5, 17, 0) +# define VMG_COMPAT_CODE_COPY_CLONE 1 +#else +# define VMG_COMPAT_CODE_COPY_CLONE 0 +#endif + #if VMG_HAS_PERL(5, 13, 2) # define VMG_COMPAT_GLOB_GET 1 #else @@ -208,7 +214,7 @@ #else -STATIC void vmg_mg_magical(SV *sv) { +static void vmg_mg_magical(SV *sv) { const MAGIC *mg; SvMAGICAL_off(sv); @@ -242,7 +248,7 @@ SVOP target; } vmg_trampoline; -STATIC void vmg_trampoline_init(vmg_trampoline *t, OP *(*cb)(pTHX)) { +static void vmg_trampoline_init(vmg_trampoline *t, OP *(*cb)(pTHX)) { t->temp.op_type = OP_STUB; t->temp.op_ppaddr = 0; t->temp.op_next = (OP *) &t->target; @@ -257,7 +263,7 @@ t->target.op_sv = NULL; } -STATIC OP *vmg_trampoline_bump(pTHX_ vmg_trampoline *t, SV *sv, OP *o) { +static OP *vmg_trampoline_bump(pTHX_ vmg_trampoline *t, SV *sv, OP *o) { #define vmg_trampoline_bump(T, S, O) vmg_trampoline_bump(aTHX_ (T), (S), (O)) t->temp = *o; t->temp.op_next = (OP *) &t->target; @@ -270,17 +276,46 @@ #endif /* VMG_NEEDS_TRAMPOLINE */ +/* --- Cleaner version of sv_magicext() ------------------------------------ */ + +static MAGIC *vmg_sv_magicext(pTHX_ SV *sv, SV *obj, const MGVTBL *vtbl, const void *ptr, I32 len) { +#define vmg_sv_magicext(S, O, V, P, L) vmg_sv_magicext(aTHX_ (S), (O), (V), (P), (L)) + MAGIC *mg; + + mg = sv_magicext(sv, obj, PERL_MAGIC_ext, vtbl, ptr, len); + if (!mg) + return NULL; + + mg->mg_private = 0; + + if (vtbl->svt_copy) + mg->mg_flags |= MGf_COPY; +#if MGf_DUP + if (vtbl->svt_dup) + mg->mg_flags |= MGf_DUP; +#endif /* MGf_DUP */ +#if MGf_LOCAL + if (vtbl->svt_local) + mg->mg_flags |= MGf_LOCAL; +#endif /* MGf_LOCAL */ + + if (mg->mg_flags & MGf_REFCOUNTED) + SvREFCNT_dec(obj); + + return mg; +} + /* --- Safe version of call_sv() ------------------------------------------- */ -STATIC I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), void *ud) { +static I32 vmg_call_sv(pTHX_ SV *sv, I32 flags, int (*cleanup)(pTHX_ void *), void *ud) { #define vmg_call_sv(S, F, C, U) vmg_call_sv(aTHX_ (S), (F), (C), (U)) I32 ret, cxix; PERL_CONTEXT saved_cx; SV *old_err = NULL; if (SvTRUE(ERRSV)) { - old_err = ERRSV; - ERRSV = newSV(0); + old_err = newSVsv(ERRSV); + sv_setsv(ERRSV, &PL_sv_undef); } cxix = (cxstack_ix < cxstack_max) ? (cxstack_ix + 1) : Perl_cxinc(aTHX); @@ -293,11 +328,8 @@ cxstack[cxix] = saved_cx; if (SvTRUE(ERRSV)) { - if (old_err) { - sv_setsv(old_err, ERRSV); - SvREFCNT_dec(ERRSV); - ERRSV = old_err; - } + SvREFCNT_dec(old_err); + if (IN_PERL_COMPILETIME) { if (!PL_in_eval) { if (PL_errors) @@ -320,8 +352,8 @@ } } else { if (old_err) { - SvREFCNT_dec(ERRSV); - ERRSV = old_err; + sv_setsv(ERRSV, old_err); + SvREFCNT_dec(old_err); } } @@ -331,22 +363,25 @@ /* --- Stolen chunk of B --------------------------------------------------- */ typedef enum { - OPc_NULL = 0, - OPc_BASEOP = 1, - OPc_UNOP = 2, - OPc_BINOP = 3, - OPc_LOGOP = 4, - OPc_LISTOP = 5, - OPc_PMOP = 6, - OPc_SVOP = 7, - OPc_PADOP = 8, - OPc_PVOP = 9, - OPc_LOOP = 10, - OPc_COP = 11, - OPc_MAX = 12 + OPc_NULL, + OPc_BASEOP, + OPc_UNOP, + OPc_BINOP, + OPc_LOGOP, + OPc_LISTOP, + OPc_PMOP, + OPc_SVOP, + OPc_PADOP, + OPc_PVOP, + OPc_LOOP, + OPc_COP, +#if VMG_HAS_PERL(5, 21, 5) + OPc_METHOP, +#endif + OPc_MAX } opclass; -STATIC const char *const vmg_opclassnames[] = { +static const char *const vmg_opclassnames[] = { "B::NULL", "B::OP", "B::UNOP", @@ -358,10 +393,14 @@ "B::PADOP", "B::PVOP", "B::LOOP", - "B::COP" + "B::COP", +#if VMG_HAS_PERL(5, 21, 5) + "B::METHOP", +#endif + NULL }; -STATIC opclass vmg_opclass(const OP *o) { +static opclass vmg_opclass(const OP *o) { #if 0 if (!o) return OPc_NULL; @@ -430,6 +469,10 @@ return OPc_BASEOP; else return OPc_PVOP; +#if VMG_HAS_PERL(5, 21, 5) + case OA_METHOP: + return OPc_METHOP; +#endif } return OPc_BASEOP; @@ -437,9 +480,9 @@ /* --- Error messages ------------------------------------------------------ */ -STATIC const char vmg_invalid_wiz[] = "Invalid wizard object"; -STATIC const char vmg_wrongargnum[] = "Wrong number of arguments"; -STATIC const char vmg_argstorefailed[] = "Error while storing arguments"; +static const char vmg_invalid_wiz[] = "Invalid wizard object"; +static const char vmg_wrongargnum[] = "Wrong number of arguments"; +static const char vmg_argstorefailed[] = "Error while storing arguments"; /* --- Context-safe global data -------------------------------------------- */ @@ -468,7 +511,7 @@ U32 refcount; } vmg_vtable; -STATIC vmg_vtable *vmg_vtable_alloc(pTHX) { +static vmg_vtable *vmg_vtable_alloc(pTHX) { #define vmg_vtable_alloc() vmg_vtable_alloc(aTHX) vmg_vtable *t; @@ -482,9 +525,9 @@ #define vmg_vtable_vtbl(T) (T)->vtbl -STATIC perl_mutex vmg_vtable_refcount_mutex; +static perl_mutex vmg_vtable_refcount_mutex; -STATIC vmg_vtable *vmg_vtable_dup(pTHX_ vmg_vtable *t) { +static vmg_vtable *vmg_vtable_dup(pTHX_ vmg_vtable *t) { #define vmg_vtable_dup(T) vmg_vtable_dup(aTHX_ (T)) VMG_LOCK(&vmg_vtable_refcount_mutex); ++t->refcount; @@ -493,7 +536,7 @@ return t; } -STATIC void vmg_vtable_free(pTHX_ vmg_vtable *t) { +static void vmg_vtable_free(pTHX_ vmg_vtable *t) { #define vmg_vtable_free(T) vmg_vtable_free(aTHX_ (T)) U32 refcount; @@ -511,7 +554,7 @@ typedef MGVTBL vmg_vtable; -STATIC vmg_vtable *vmg_vtable_alloc(pTHX) { +static vmg_vtable *vmg_vtable_alloc(pTHX) { #define vmg_vtable_alloc() vmg_vtable_alloc(aTHX) vmg_vtable *t; @@ -546,9 +589,9 @@ #endif /* VMG_UVAR */ } vmg_wizard; -STATIC void vmg_op_info_init(pTHX_ unsigned int opinfo); +static void vmg_op_info_init(pTHX_ unsigned int opinfo); -STATIC vmg_wizard *vmg_wizard_alloc(pTHX_ UV opinfo) { +static vmg_wizard *vmg_wizard_alloc(pTHX_ UV opinfo) { #define vmg_wizard_alloc(O) vmg_wizard_alloc(aTHX_ (O)) vmg_wizard *w; @@ -564,7 +607,7 @@ return w; } -STATIC void vmg_wizard_free(pTHX_ vmg_wizard *w) { +static void vmg_wizard_free(pTHX_ vmg_wizard *w) { #define vmg_wizard_free(W) vmg_wizard_free(aTHX_ (W)) if (!w) return; @@ -607,7 +650,7 @@ z->cb_ ## N = (w->cb_ ## N) ? SvREFCNT_inc(sv_dup(w->cb_ ## N, params)) \ : NULL; -STATIC const vmg_wizard *vmg_wizard_dup(pTHX_ const vmg_wizard *w, CLONE_PARAMS *params) { +static const vmg_wizard *vmg_wizard_dup(pTHX_ const vmg_wizard *w, CLONE_PARAMS *params) { #define vmg_wizard_dup(W, P) vmg_wizard_dup(aTHX_ (W), (P)) vmg_wizard *z; @@ -647,7 +690,7 @@ /* --- Wizard SV objects --------------------------------------------------- */ -STATIC int vmg_wizard_sv_free(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_wizard_sv_free(pTHX_ SV *sv, MAGIC *mg) { vmg_wizard_free((vmg_wizard *) mg->mg_ptr); return 0; @@ -655,7 +698,7 @@ #if VMG_THREADSAFE -STATIC int vmg_wizard_sv_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { +static int vmg_wizard_sv_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { mg->mg_ptr = (char *) vmg_wizard_dup((const vmg_wizard *) mg->mg_ptr, params); return 0; @@ -663,7 +706,7 @@ #endif /* VMG_THREADSAFE */ -STATIC MGVTBL vmg_wizard_sv_vtbl = { +static MGVTBL vmg_wizard_sv_vtbl = { NULL, /* get */ NULL, /* set */ NULL, /* len */ @@ -680,7 +723,7 @@ #endif /* MGf_LOCAL */ }; -STATIC SV *vmg_wizard_sv_new(pTHX_ const vmg_wizard *w) { +static SV *vmg_wizard_sv_new(pTHX_ const vmg_wizard *w) { #define vmg_wizard_sv_new(W) vmg_wizard_sv_new(aTHX_ (W)) SV *wiz; @@ -690,14 +733,8 @@ wiz = newSViv(PTR2IV(w)); #endif - if (w) { - MAGIC *mg = sv_magicext(wiz, NULL, PERL_MAGIC_ext, &vmg_wizard_sv_vtbl, - (const char *) w, 0); - mg->mg_private = 0; -#if VMG_THREADSAFE - mg->mg_flags |= MGf_DUP; -#endif - } + vmg_sv_magicext(wiz, NULL, &vmg_wizard_sv_vtbl, w, 0); + SvREADONLY_on(wiz); return wiz; @@ -707,7 +744,7 @@ #define vmg_sv_has_wizard_type(S) (SvTYPE(S) >= SVt_PVMG) -STATIC const vmg_wizard *vmg_wizard_from_sv_nocheck(const SV *wiz) { +static const vmg_wizard *vmg_wizard_from_sv_nocheck(const SV *wiz) { MAGIC *mg; for (mg = SvMAGIC(wiz); mg; mg = mg->mg_moremagic) { @@ -728,7 +765,7 @@ #define vmg_wizard_from_sv(W) (vmg_sv_has_wizard_type(W) ? vmg_wizard_from_sv_nocheck(W) : NULL) -STATIC const vmg_wizard *vmg_wizard_from_mg(const MAGIC *mg) { +static const vmg_wizard *vmg_wizard_from_mg(const MAGIC *mg) { if (mg->mg_type == PERL_MAGIC_ext && mg->mg_len == HEf_SVKEY) { SV *sv = (SV *) mg->mg_ptr; @@ -743,7 +780,7 @@ /* --- User-level functions implementation --------------------------------- */ -STATIC const MAGIC *vmg_find(const SV *sv, const vmg_wizard *w) { +static const MAGIC *vmg_find(const SV *sv, const vmg_wizard *w) { const MAGIC *mg; IV wid; @@ -764,7 +801,7 @@ /* ... Construct private data .............................................. */ -STATIC SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, SV **args, I32 items) { +static SV *vmg_data_new(pTHX_ SV *ctor, SV *sv, SV **args, I32 items) { #define vmg_data_new(C, S, A, I) vmg_data_new(aTHX_ (C), (S), (A), (I)) I32 i; SV *nsv; @@ -798,7 +835,7 @@ return nsv; } -STATIC SV *vmg_data_get(pTHX_ SV *sv, const vmg_wizard *w) { +static SV *vmg_data_get(pTHX_ SV *sv, const vmg_wizard *w) { #define vmg_data_get(S, W) vmg_data_get(aTHX_ (S), (W)) const MAGIC *mg = vmg_find(sv, w); @@ -809,7 +846,7 @@ #if VMG_UVAR -STATIC I32 vmg_svt_val(pTHX_ IV, SV *); +static I32 vmg_svt_val(pTHX_ IV, SV *); typedef struct { struct ufuncs new_uf; @@ -818,7 +855,7 @@ #endif /* VMG_UVAR */ -STATIC void vmg_mg_del(pTHX_ SV *sv, MAGIC *prevmagic, MAGIC *mg, MAGIC *moremagic) { +static void vmg_mg_del(pTHX_ SV *sv, MAGIC *prevmagic, MAGIC *mg, MAGIC *moremagic) { #define vmg_mg_del(S, P, M, N) vmg_mg_del(aTHX_ (S), (P), (M), (N)) dMY_CXT; @@ -853,7 +890,7 @@ } } -STATIC int vmg_magic_chain_free(pTHX_ MAGIC *mg, MAGIC *skip) { +static int vmg_magic_chain_free(pTHX_ MAGIC *mg, MAGIC *skip) { #define vmg_magic_chain_free(M, S) vmg_magic_chain_free(aTHX_ (M), (S)) int skipped = 0; @@ -871,7 +908,7 @@ return skipped; } -STATIC UV vmg_cast(pTHX_ SV *sv, const vmg_wizard *w, const SV *wiz, SV **args, I32 items) { +static UV vmg_cast(pTHX_ SV *sv, const vmg_wizard *w, const SV *wiz, SV **args, I32 items) { #define vmg_cast(S, W, WIZ, A, I) vmg_cast(aTHX_ (S), (W), (WIZ), (A), (I)) MAGIC *mg; MGVTBL *t; @@ -886,22 +923,7 @@ data = (w->cb_data) ? vmg_data_new(w->cb_data, sv, args, items) : NULL; t = vmg_vtable_vtbl(w->vtable); - mg = sv_magicext(sv, data, PERL_MAGIC_ext, t, (const char *) wiz, HEf_SVKEY); - mg->mg_private = 0; - - /* sv_magicext() calls mg_magical and increments data's refcount */ - SvREFCNT_dec(data); - - if (t->svt_copy) - mg->mg_flags |= MGf_COPY; -#if 0 - if (t->svt_dup) - mg->mg_flags |= MGf_DUP; -#endif -#if MGf_LOCAL - if (t->svt_local) - mg->mg_flags |= MGf_LOCAL; -#endif /* MGf_LOCAL */ + mg = vmg_sv_magicext(sv, data, t, wiz, HEf_SVKEY); if (SvTYPE(sv) < SVt_PVHV) goto done; @@ -957,7 +979,7 @@ return 1; } -STATIC UV vmg_dispell(pTHX_ SV *sv, const vmg_wizard *w) { +static UV vmg_dispell(pTHX_ SV *sv, const vmg_wizard *w) { #define vmg_dispell(S, W) vmg_dispell(aTHX_ (S), (W)) #if VMG_UVAR U32 uvars = 0; @@ -1047,13 +1069,13 @@ #define VMG_OP_INFO_OBJECT 2 #if VMG_THREADSAFE -STATIC perl_mutex vmg_op_name_init_mutex; +static perl_mutex vmg_op_name_init_mutex; #endif -STATIC U32 vmg_op_name_init = 0; -STATIC unsigned char vmg_op_name_len[MAXO] = { 0 }; +static U32 vmg_op_name_init = 0; +static unsigned char vmg_op_name_len[MAXO] = { 0 }; -STATIC void vmg_op_info_init(pTHX_ unsigned int opinfo) { +static void vmg_op_info_init(pTHX_ unsigned int opinfo) { #define vmg_op_info_init(W) vmg_op_info_init(aTHX_ (W)) switch (opinfo) { case VMG_OP_INFO_NAME: @@ -1081,7 +1103,7 @@ } } -STATIC SV *vmg_op_info(pTHX_ unsigned int opinfo) { +static SV *vmg_op_info(pTHX_ unsigned int opinfo) { #define vmg_op_info(W) vmg_op_info(aTHX_ (W)) if (!PL_op) return &PL_sv_undef; @@ -1110,7 +1132,7 @@ #define VMG_CB_CALL_OPINFO (VMG_OP_INFO_NAME|VMG_OP_INFO_OBJECT) /* 1|2 */ #define VMG_CB_CALL_GUARD 4 -STATIC int vmg_dispell_guard_oncroak(pTHX_ void *ud) { +static int vmg_dispell_guard_oncroak(pTHX_ void *ud) { dMY_CXT; MY_CXT.depth--; @@ -1126,7 +1148,7 @@ return 1; } -STATIC int vmg_dispell_guard_free(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_dispell_guard_free(pTHX_ SV *sv, MAGIC *mg) { vmg_magic_chain_free((MAGIC *) mg->mg_ptr, NULL); return 0; @@ -1134,7 +1156,7 @@ #if VMG_THREADSAFE -STATIC int vmg_dispell_guard_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { +static int vmg_dispell_guard_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *params) { /* The freed magic tokens aren't cloned by perl because it cannot reach them * (they have been detached from their parent SV when they were enqueued). * Hence there's nothing to purge in the new thread. */ @@ -1145,7 +1167,7 @@ #endif /* VMG_THREADSAFE */ -STATIC MGVTBL vmg_dispell_guard_vtbl = { +static MGVTBL vmg_dispell_guard_vtbl = { NULL, /* get */ NULL, /* set */ NULL, /* len */ @@ -1162,18 +1184,17 @@ #endif /* MGf_LOCAL */ }; -STATIC SV *vmg_dispell_guard_new(pTHX_ MAGIC *root) { +static SV *vmg_dispell_guard_new(pTHX_ MAGIC *root) { #define vmg_dispell_guard_new(R) vmg_dispell_guard_new(aTHX_ (R)) SV *guard; guard = sv_newmortal(); - sv_magicext(guard, NULL, PERL_MAGIC_ext, &vmg_dispell_guard_vtbl, - (char *) root, 0); + vmg_sv_magicext(guard, NULL, &vmg_dispell_guard_vtbl, root, 0); return guard; } -STATIC int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { +static int vmg_cb_call(pTHX_ SV *cb, unsigned int flags, SV *sv, ...) { va_list ap; int ret = 0; unsigned int i, args, opinfo; @@ -1242,13 +1263,13 @@ /* ... Default no-op magic callback ........................................ */ -STATIC int vmg_svt_default_noop(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_svt_default_noop(pTHX_ SV *sv, MAGIC *mg) { return 0; } /* ... get magic ........................................................... */ -STATIC int vmg_svt_get(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_svt_get(pTHX_ SV *sv, MAGIC *mg) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); return vmg_cb_call1(w->cb_get, w->opinfo, sv, mg->mg_obj); @@ -1258,7 +1279,7 @@ /* ... set magic ........................................................... */ -STATIC int vmg_svt_set(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_svt_set(pTHX_ SV *sv, MAGIC *mg) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); return vmg_cb_call1(w->cb_set, w->opinfo, sv, mg->mg_obj); @@ -1268,7 +1289,7 @@ /* ... len magic ........................................................... */ -STATIC U32 vmg_sv_len(pTHX_ SV *sv) { +static U32 vmg_sv_len(pTHX_ SV *sv) { #define vmg_sv_len(S) vmg_sv_len(aTHX_ (S)) STRLEN len; #if VMG_HAS_PERL(5, 9, 3) @@ -1280,7 +1301,7 @@ return DO_UTF8(sv) ? utf8_length(s, s + len) : len; } -STATIC U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) { +static U32 vmg_svt_len(pTHX_ SV *sv, MAGIC *mg) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); unsigned int opinfo = w->opinfo; U32 len, ret; @@ -1325,7 +1346,7 @@ return ret; } -STATIC U32 vmg_svt_len_noop(pTHX_ SV *sv, MAGIC *mg) { +static U32 vmg_svt_len_noop(pTHX_ SV *sv, MAGIC *mg) { U32 len = 0; svtype t = SvTYPE(sv); @@ -1340,7 +1361,7 @@ /* ... clear magic ......................................................... */ -STATIC int vmg_svt_clear(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_svt_clear(pTHX_ SV *sv, MAGIC *mg) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); unsigned int flags = w->opinfo; @@ -1357,12 +1378,12 @@ #if VMG_PROPAGATE_ERRSV_NEEDS_TRAMPOLINE -STATIC OP *vmg_pp_propagate_errsv(pTHX) { +static OP *vmg_pp_propagate_errsv(pTHX) { SVOP *o = cSVOPx(PL_op); if (o->op_sv) { - SvREFCNT_dec(ERRSV); - ERRSV = o->op_sv; + sv_setsv(ERRSV, o->op_sv); + SvREFCNT_dec(o->op_sv); o->op_sv = NULL; } @@ -1371,12 +1392,9 @@ #endif /* VMG_PROPAGATE_ERRSV_NEEDS_TRAMPOLINE */ -STATIC int vmg_propagate_errsv_free(pTHX_ SV *sv, MAGIC *mg) { - if (mg->mg_obj) { - ERRSV = mg->mg_obj; - mg->mg_obj = NULL; - mg->mg_flags &= ~MGf_REFCOUNTED; - } +static int vmg_propagate_errsv_free(pTHX_ SV *sv, MAGIC *mg) { + if (mg->mg_obj) + sv_setsv(ERRSV, mg->mg_obj); return 0; } @@ -1384,7 +1402,7 @@ /* perl is already kind enough to handle the cloning of the mg_obj member, hence we don't need to define a dup magic callback. */ -STATIC MGVTBL vmg_propagate_errsv_vtbl = { +static MGVTBL vmg_propagate_errsv_vtbl = { 0, /* get */ 0, /* set */ 0, /* len */ @@ -1403,7 +1421,7 @@ I32 base; } vmg_svt_free_cleanup_ud; -STATIC int vmg_svt_free_cleanup(pTHX_ void *ud_) { +static int vmg_svt_free_cleanup(pTHX_ void *ud_) { vmg_svt_free_cleanup_ud *ud = VOID2(vmg_svt_free_cleanup_ud *, ud_); if (ud->in_eval) { @@ -1421,20 +1439,16 @@ PL_op = vmg_trampoline_bump(&MY_CXT.propagate_errsv, errsv, PL_op); } else if (optype == OP_LEAVEEVAL) { SV *guard = sv_newmortal(); - sv_magicext(guard, errsv, PERL_MAGIC_ext, &vmg_propagate_errsv_vtbl, - NULL, 0); + vmg_sv_magicext(guard, errsv, &vmg_propagate_errsv_vtbl, NULL, 0); } #else /* !VMG_PROPAGATE_ERRSV_NEEDS_TRAMPOLINE */ # if !VMG_HAS_PERL(5, 8, 9) { SV *guard = sv_newmortal(); - sv_magicext(guard, errsv, PERL_MAGIC_ext, &vmg_propagate_errsv_vtbl, - NULL, 0); + vmg_sv_magicext(guard, errsv, &vmg_propagate_errsv_vtbl, NULL, 0); } # else - sv_magicext(ERRSV, errsv, PERL_MAGIC_ext, &vmg_propagate_errsv_vtbl, - NULL, 0); - SvREFCNT_dec(errsv); + vmg_sv_magicext(ERRSV, errsv, &vmg_propagate_errsv_vtbl, NULL, 0); # endif #endif /* VMG_PROPAGATE_ERRSV_NEEDS_TRAMPOLINE */ @@ -1463,7 +1477,7 @@ } } -STATIC int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { +static int vmg_svt_free(pTHX_ SV *sv, MAGIC *mg) { vmg_svt_free_cleanup_ud ud; const vmg_wizard *w; int ret = 0; @@ -1549,7 +1563,7 @@ /* ... copy magic .......................................................... */ -STATIC int vmg_svt_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv, const char *key, VMG_SVT_COPY_KEYLEN_TYPE keylen) { +static int vmg_svt_copy(pTHX_ SV *sv, MAGIC *mg, SV *nsv, const char *key, VMG_SVT_COPY_KEYLEN_TYPE keylen) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); SV *keysv; int ret; @@ -1560,6 +1574,9 @@ keysv = newSVpvn(key, keylen); } + if (SvTYPE(sv) >= SVt_PVCV) + nsv = sv_2mortal(newRV_inc(nsv)); + ret = vmg_cb_call3(w->cb_copy, w->opinfo, sv, mg->mg_obj, keysv, nsv); if (keylen != HEf_SVKEY) { @@ -1569,14 +1586,14 @@ return ret; } -STATIC int vmg_svt_copy_noop(pTHX_ SV *sv, MAGIC *mg, SV *nsv, const char *key, VMG_SVT_COPY_KEYLEN_TYPE keylen) { +static int vmg_svt_copy_noop(pTHX_ SV *sv, MAGIC *mg, SV *nsv, const char *key, VMG_SVT_COPY_KEYLEN_TYPE keylen) { return 0; } /* ... dup magic ........................................................... */ #if 0 -STATIC int vmg_svt_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { +static int vmg_svt_dup(pTHX_ MAGIC *mg, CLONE_PARAMS *param) { return 0; } #define vmg_svt_dup_noop vmg_svt_dup @@ -1586,7 +1603,7 @@ #if MGf_LOCAL -STATIC int vmg_svt_local(pTHX_ SV *nsv, MAGIC *mg) { +static int vmg_svt_local(pTHX_ SV *nsv, MAGIC *mg) { const vmg_wizard *w = vmg_wizard_from_mg_nocheck(mg); return vmg_cb_call1(w->cb_local, w->opinfo, nsv, mg->mg_obj); @@ -1600,7 +1617,7 @@ #if VMG_UVAR -STATIC OP *vmg_pp_reset_rmg(pTHX) { +static OP *vmg_pp_reset_rmg(pTHX) { SVOP *o = cSVOPx(PL_op); SvRMAGICAL_on(o->op_sv); @@ -1609,7 +1626,7 @@ return NORMAL; } -STATIC I32 vmg_svt_val(pTHX_ IV action, SV *sv) { +static I32 vmg_svt_val(pTHX_ IV action, SV *sv) { vmg_uvar_ud *ud; MAGIC *mg, *umg, *moremagic; SV *key = NULL, *newkey = NULL; @@ -1817,6 +1834,8 @@ newSVuv(VMG_COMPAT_ARRAY_UNDEF_CLEAR)); newCONSTSUB(stash, "VMG_COMPAT_HASH_DELETE_NOUVAR_VOID", newSVuv(VMG_COMPAT_HASH_DELETE_NOUVAR_VOID)); + newCONSTSUB(stash, "VMG_COMPAT_CODE_COPY_CLONE", + newSVuv(VMG_COMPAT_CODE_COPY_CLONE)); newCONSTSUB(stash, "VMG_COMPAT_GLOB_GET", newSVuv(VMG_COMPAT_GLOB_GET)); newCONSTSUB(stash, "VMG_PERL_PATCHLEVEL", newSVuv(VMG_PERL_PATCHLEVEL)); newCONSTSUB(stash, "VMG_THREADSAFE", newSVuv(VMG_THREADSAFE)); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/Makefile.PL new/Variable-Magic-0.56/Makefile.PL --- old/Variable-Magic-0.53/Makefile.PL 2013-08-29 01:18:16.000000000 +0200 +++ new/Variable-Magic-0.56/Makefile.PL 2015-03-11 14:23:45.000000000 +0100 @@ -75,6 +75,7 @@ 'Config' => 0, 'ExtUtils::MakeMaker' => 0, 'Test::More' => 0, + 'lib' => 0, %PREREQ_PM, ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/README new/Variable-Magic-0.56/README --- old/Variable-Magic-0.53/README 2013-09-01 19:43:05.000000000 +0200 +++ new/Variable-Magic-0.56/README 2015-03-11 16:04:00.000000000 +0100 @@ -2,7 +2,7 @@ Variable::Magic - Associate user-defined magic to variables from Perl. VERSION - Version 0.53 + Version 0.56 SYNOPSIS use Variable::Magic qw<wizard cast VMG_OP_INFO_NAME>; @@ -132,8 +132,13 @@ * *copy* - 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 "VMG_COMPAT_CODE_COPY_CLONE" constant is + true when your perl support this feature. * *dup* @@ -225,10 +230,15 @@ * *copy* - $_[2] is a either an alias or a copy of the current key, and - $_[3] is an alias to the current element (i.e. the value). - Because $_[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, $_[2] is a either an alias or a copy of the + current key, and $_[3] is an alias to the current element + (i.e. the value). Since $_[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, $_[2] is always "undef" and + $_[3] is a reference to the cloned anonymous subroutine. * *fetch*, *store*, *exists* and *delete* @@ -385,6 +395,10 @@ True for perls that don't call *delete* magic when you delete an element from a hash in void context. + "VMG_COMPAT_CODE_COPY_CLONE" + True for perls that call *copy* magic when a magical closure prototype + is cloned. + "VMG_COMPAT_GLOB_GET" True for perls that call *get* magic for operations on globs. @@ -562,11 +576,6 @@ Carp (core since perl 5), XSLoader (since 5.6.0). - Copy tests need Tie::Array (core since perl 5.005) and Tie::Hash (since - 5.002). Some uvar tests need Hash::Util::FieldHash (since 5.9.4). Glob - tests need Symbol (since 5.002). Threads tests need threads and - threads::shared (both since 5.7.3). - SEE ALSO perlguts and perlapi for internal information about magic. @@ -593,8 +602,8 @@ <http://www.profvince.com/perl/cover/Variable-Magic>. COPYRIGHT & LICENSE - Copyright 2007,2008,2009,2010,2011,2012,2013 Vincent Pit, all rights - reserved. + Copyright 2007,2008,2009,2010,2011,2012,2013,2014,2015 Vincent Pit, all + rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/lib/Variable/Magic.pm new/Variable-Magic-0.56/lib/Variable/Magic.pm --- old/Variable-Magic-0.53/lib/Variable/Magic.pm 2013-09-01 19:42:22.000000000 +0200 +++ new/Variable-Magic-0.56/lib/Variable/Magic.pm 2015-03-11 16:01:10.000000000 +0100 @@ -11,13 +11,13 @@ =head1 VERSION -Version 0.53 +Version 0.56 =cut our $VERSION; BEGIN { - $VERSION = '0.53'; + $VERSION = '0.56'; } =head1 SYNOPSIS @@ -152,7 +152,10 @@ I<copy> -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</VMG_COMPAT_CODE_COPY_CLONE> constant is true when your perl support this feature. =item * @@ -269,8 +272,11 @@ I<copy> -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<undef> and C<$_[3]> is a reference to the cloned anonymous subroutine. =item * @@ -463,6 +469,10 @@ True for perls that don't call I<delete> magic when you delete an element from a hash in void context. +=head2 C<VMG_COMPAT_CODE_COPY_CLONE> + +True for perls that call I<copy> magic when a magical closure prototype is cloned. + =head2 C<VMG_COMPAT_GLOB_GET> True for perls that call I<get> magic for operations on globs. @@ -646,6 +656,7 @@ 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 @@ -673,11 +684,6 @@ L<Carp> (core since perl 5), L<XSLoader> (since 5.6.0). -Copy tests need L<Tie::Array> (core since perl 5.005) and L<Tie::Hash> (since 5.002). -Some uvar tests need L<Hash::Util::FieldHash> (since 5.9.4). -Glob tests need L<Symbol> (since 5.002). -Threads tests need L<threads> and L<threads::shared> (both since 5.7.3). - =head1 SEE ALSO L<perlguts> and L<perlapi> for internal information about magic. @@ -705,7 +711,7 @@ =head1 COPYRIGHT & LICENSE -Copyright 2007,2008,2009,2010,2011,2012,2013 Vincent Pit, all rights reserved. +Copyright 2007,2008,2009,2010,2011,2012,2013,2014,2015 Vincent Pit, all rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/01-import.t new/Variable-Magic-0.56/t/01-import.t --- old/Variable-Magic-0.53/t/01-import.t 2013-06-03 15:19:02.000000000 +0200 +++ new/Variable-Magic-0.56/t/01-import.t 2014-10-20 23:23:19.000000000 +0200 @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 2 * 21; +use Test::More tests => 2 * 22; require Variable::Magic; @@ -20,6 +20,7 @@ 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 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/15-self.t new/Variable-Magic-0.56/t/15-self.t --- old/Variable-Magic-0.53/t/15-self.t 2012-08-18 16:17:19.000000000 +0200 +++ new/Variable-Magic-0.56/t/15-self.t 2015-03-10 20:12:45.000000000 +0100 @@ -1,4 +1,4 @@ -#!perl -T +#!perl use strict; use warnings; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/17-ctl.t new/Variable-Magic-0.56/t/17-ctl.t --- old/Variable-Magic-0.53/t/17-ctl.t 2013-06-03 15:18:58.000000000 +0200 +++ new/Variable-Magic-0.56/t/17-ctl.t 2014-10-20 23:23:19.000000000 +0200 @@ -5,6 +5,9 @@ use Test::More tests => 4 * 8 + 4 * (2 * 6 + 1) + 10 + 1 + 1; +use lib 't/lib'; +use VPIT::TestHelpers; + use Variable::Magic qw<wizard cast VMG_UVAR>; sub expect { @@ -342,17 +345,6 @@ like $@, expect('tomato', undef, "\nBEGIN.*"), 'die in BEGIN in eval triggers hints hash destructor'; -sub run_perl { - my $code = shift; - - my ($SystemRoot, $PATH) = @ENV{qw<SystemRoot PATH>}; - local %ENV; - $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot; - $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH; - - system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code; -} - my $has_capture_tiny = do { local $@; eval { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/18-opinfo.t new/Variable-Magic-0.56/t/18-opinfo.t --- old/Variable-Magic-0.53/t/18-opinfo.t 2012-06-23 23:20:03.000000000 +0200 +++ new/Variable-Magic-0.56/t/18-opinfo.t 2014-10-21 00:10:58.000000000 +0200 @@ -20,6 +20,7 @@ my $aelemf = ("$]" < 5.013 or $is_5130_release) ? 'aelemfast' : 'sassign'; my $aelemf_op = $aelemf eq 'sassign' ? 'B::BINOP' : $Config{useithreads} ? 'B::PADOP' : 'B::SVOP'; +my $meth_op = ("$]" < 5.021_005) ? 'B::SVOP' : 'B::METHOP'; our @o; @@ -39,7 +40,7 @@ [ 'bless', 'B::LISTOP' ] ], [ 'get', '$c', 'my $c = ""','$c =~ /x/', [ 'match', 'B::PMOP' ] ], [ 'get', '$c', 'my $c = "Variable::Magic::TestPkg"', - '$c->foo()', [ 'method_named', 'B::SVOP' ] ], + '$c->foo()', [ 'method_named', $meth_op ] ], [ 'get', '$c', 'my $c = ""','$c =~ y/x/y/', [ 'trans', 'B::PVOP' ] ], [ 'get', '$c', 'my $c = 1', '1 for 1 .. $c', [ 'enteriter', 'B::LOOP' ] ], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/25-copy.t new/Variable-Magic-0.56/t/25-copy.t --- old/Variable-Magic-0.53/t/25-copy.t 2013-06-03 15:19:02.000000000 +0200 +++ new/Variable-Magic-0.56/t/25-copy.t 2014-10-20 23:23:19.000000000 +0200 @@ -8,9 +8,9 @@ use lib 't/lib'; use VPIT::TestHelpers; -use Variable::Magic qw<cast dispell>; +use Variable::Magic qw<wizard cast dispell VMG_COMPAT_CODE_COPY_CLONE>; -plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 1; +plan tests => 2 + ((2 * 5 + 3) + (2 * 2 + 1)) + (2 * 9 + 6) + 3 + 1; use lib 't/lib'; use Variable::Magic::TestWatcher; @@ -80,3 +80,23 @@ watch { undef %h } { }, 'tied hash undef'; } + +SKIP: { + skip 'copy magic not called for cloned prototypes before perl 5.17.0' => 3 + unless VMG_COMPAT_CODE_COPY_CLONE; + my $w = wizard copy => sub { + is ref($_[0]), 'CODE', 'first arg in copy on clone is a code ref'; + is $_[2], undef, 'third arg in copy on clone is undef'; + is ref($_[3]), 'CODE', 'fourth arg in copy on clone is a code ref'; + }; + eval <<'TEST_COPY'; + package X; + sub MODIFY_CODE_ATTRIBUTES { + my ($pkg, $sub) = @_; + &Variable::Magic::cast($sub, $w); + return; + } + my $i; + my $f = sub : Hello { $i }; +TEST_COPY +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/35-stash.t new/Variable-Magic-0.56/t/35-stash.t --- old/Variable-Magic-0.53/t/35-stash.t 2013-06-03 15:19:02.000000000 +0200 +++ new/Variable-Magic-0.56/t/35-stash.t 2014-10-20 23:23:19.000000000 +0200 @@ -92,11 +92,19 @@ }; my @calls = qw<eat shoot leave roam yawn roam>; + my (@fetch, @store); + if ("$]" >= 5.011_002 && "$]" < 5.021_004) { + @fetch = @calls; + @store = map { ($_) x 2 } @calls; + } else { + @fetch = @calls; + @store = @calls; + } is $@, "ok\n", 'stash: function calls compiled fine'; is_deeply \%mg, { - fetch => \@calls, - store => ("$]" < 5.011_002 ? \@calls : [ map { ($_) x 2 } @calls ]), + fetch => \@fetch, + store => \@store, }, 'stash: function calls'; } @@ -296,7 +304,7 @@ CB } qw<fetch store exists delete>); -my $uo_exp = "$]" < 5.011_002 ? 2 : 3; +my $uo_exp = "$]" >= 5.011_002 && "$]" < 5.021_004 ? 3 : 2; $code .= ', data => sub { +{ guard => 0 } }'; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/lib/VPIT/TestHelpers.pm new/Variable-Magic-0.56/t/lib/VPIT/TestHelpers.pm --- old/Variable-Magic-0.53/t/lib/VPIT/TestHelpers.pm 2013-06-03 15:19:02.000000000 +0200 +++ new/Variable-Magic-0.56/t/lib/VPIT/TestHelpers.pm 2015-03-11 15:39:13.000000000 +0100 @@ -3,9 +3,12 @@ use strict; use warnings; +use Config (); + my %exports = ( load_or_skip => \&load_or_skip, load_or_skip_all => \&load_or_skip_all, + run_perl => \&run_perl, skip_all => \&skip_all, ); @@ -102,6 +105,21 @@ return $loaded; } +sub run_perl { + my $code = shift; + + my ($SystemRoot, $PATH) = @ENV{qw<SystemRoot PATH>}; + my $ld_name = $Config::Config{ldlibpthname}; + my $ldlibpth = $ENV{$ld_name}; + + local %ENV; + $ENV{$ld_name} = $ldlibpth if defined $ldlibpth; + $ENV{SystemRoot} = $SystemRoot if $^O eq 'MSWin32' and defined $SystemRoot; + $ENV{PATH} = $PATH if $^O eq 'cygwin' and defined $PATH; + + system { $^X } $^X, '-T', map("-I$_", @INC), '-e', $code; +} + package VPIT::TestHelpers::Guard; sub new { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Variable-Magic-0.53/t/lib/Variable/Magic/TestGlobalDestruction.pm new/Variable-Magic-0.56/t/lib/Variable/Magic/TestGlobalDestruction.pm --- old/Variable-Magic-0.53/t/lib/Variable/Magic/TestGlobalDestruction.pm 2012-06-24 23:59:52.000000000 +0200 +++ new/Variable-Magic-0.56/t/lib/Variable/Magic/TestGlobalDestruction.pm 2015-03-10 20:12:45.000000000 +0100 @@ -12,27 +12,75 @@ Test::More::diag(@_); } +my $is_debugging; + +sub is_debugging_perl { + return $is_debugging if defined $is_debugging; + + my $source; + + my $has_config_perl_v = do { + local $@; + eval { require Config::Perl::V; 1 }; + }; + + if ($has_config_perl_v) { + $is_debugging = do { + local $@; + eval { Config::Perl::V::myconfig()->{build}{options}{DEBUGGING} }; + }; + + if (defined $is_debugging) { + $source = "Config::Perl::V version $Config::Perl::V::VERSION"; + } + } + + unless (defined $is_debugging) { + $is_debugging = 0; + $source = "%Config"; + + require Config; + my @fields = qw<ccflags cppflags optimize>; + + for my $field (@fields) { + my $content = $Config::Config{$field}; + + while ($content =~ /(-DD?EBUGGING((?:=\S*)?))/g) { + my $extra = $2 || ''; + if ($extra ne '=none') { + $is_debugging = 1; + $source = "\$Config{$field} =~ /$1/"; + } + } + } + } + + my $maybe_is = $is_debugging ? "is" : "is NOT"; + _diag("According to $source, this $maybe_is a debugging perl"); + + return $is_debugging; +} + sub import { shift; my %args = @_; my $level = $args{level} || 1; + if ("$]" < 5.013_004 and not $ENV{PERL_VARIABLE_MAGIC_TEST_THREADS}) { + _diag("perl 5.13.4 required to safely test global destruction"); + return 0; + } + my $env_level = int($ENV{PERL_DESTRUCT_LEVEL} || 0); if ($env_level >= $level) { - my $is_debugging = do { - local $@; - eval { - require Config; - grep /-DDEBUGGING\b/, @Config::Config{qw<ccflags cppflags optimize>}; - } - }; - require Test::More; + my $is_debugging = is_debugging_perl(); + if ($is_debugging) { _diag("Global destruction level $env_level set by PERL_DESTRUCT_LEVEL (debugging perl)"); - return; - } else { - _diag("PERL_DESTRUCT_LEVEL is set to $env_level, but this perl doesn't seem to have debugging enabled"); + return 1; } + + _diag("PERL_DESTRUCT_LEVEL is set to $env_level, but this perl doesn't seem to have debugging enabled"); } my $has_perl_destruct_level = do { @@ -43,10 +91,14 @@ 1; } }; + if ($has_perl_destruct_level) { _diag("Global destruction level $level set by Perl::Destruct::Level"); - return; + return 1; } + + _diag("Not testing global destruction"); + return 0; } 1; ++++++ cpanspec.yml ++++++ --- description_paragraphs: 2 #no_testing: broken upstream #sources: # - source1 # - source2 #patches: # foo.patch: -p1 # bar.patch: #preamble: |- # BuildRequires: gcc-c++ #post_prep: |- # hunspell=`pkg-config --libs hunspell | sed -e 's,-l,,; s, *,,g'` # sed -i -e "s,hunspell-X,$hunspell," t/00-prereq.t Makefile.PL #post_install: |- # sed on %{name}.files #license: SUSE-NonFree #skip_noarch: 1 #custom_build: - #./Build build flags=%{?_smp_mflags} --myflag