From: Matthijs van Duin Date: Fri, 18 Jul 2008 13:26:38 +0000 (-0800) Subject: import Sub-Name 0.04 from CPAN X-Git-Tag: 0.04 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit%2FSub-Name.git;a=commitdiff_plain;h=979516cc8e7e4004baeafaf1afb5bf4069401c5d import Sub-Name 0.04 from CPAN git-cpan-module: Sub-Name git-cpan-version: 0.04 git-cpan-authorid: XMATH git-cpan-file: authors/id/X/XM/XMATH/Sub-Name-0.04.tar.gz --- diff --git a/Changes b/Changes index ad36e58..e98267c 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,5 @@ -$Id: Changes,v 1.1 2004/08/18 17:53:45 xmath Exp $ +0.04 -- Fri Jul 18 15:23 CEST 2008 + * Fixed for perl 5.6 and 5.005 threads (tested) 0.03 -- Wed Feb 20 20:19 CET 2008 * Fixed crash when trying to rename xsubs diff --git a/META.yml b/META.yml index 469eb94..d8fae10 100644 --- a/META.yml +++ b/META.yml @@ -1,10 +1,13 @@ -# http://module-build.sourceforge.net/META-spec.html -#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# -name: Sub-Name -version: 0.03 -version_from: lib/Sub/Name.pm -installdirs: site -requires: - -distribution_type: module -generated_by: ExtUtils::MakeMaker version 6.17 +--- #YAML:1.0 +name: Sub-Name +version: 0.04 +abstract: (re)name a sub +license: ~ +author: + - Matthijs van Duin +generated_by: ExtUtils::MakeMaker version 6.42 +distribution_type: module +requires: +meta-spec: + url: http://module-build.sourceforge.net/META-spec-v1.3.html + version: 1.3 diff --git a/Makefile.PL b/Makefile.PL index 5c8a75f..ea889a4 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,5 +1,3 @@ -# $Id: Makefile.PL,v 1.1 2004/08/17 19:23:24 xmath Exp $ - use 5.006; use ExtUtils::MakeMaker; diff --git a/Name.xs b/Name.xs index 6a4dc32..b32411b 100644 --- a/Name.xs +++ b/Name.xs @@ -1,5 +1,4 @@ -/* $Id: Name.xs,v 1.5 2004/08/18 13:21:44 xmath Exp $ - * Copyright (C) 2004 Matthijs van Duin. All rights reserved. +/* Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. * This program is free software; you can redistribute it and/or modify * it under the same terms as Perl itself. */ @@ -10,6 +9,15 @@ static MGVTBL subname_vtbl; +#ifndef PERL_MAGIC_ext +# define PERL_MAGIC_ext '~' +#endif + +#ifndef SvMAGIC_set +#define SvMAGIC_set(sv, val) (SvMAGIC(sv) = (val)) +#endif + + MODULE = Sub::Name PACKAGE = Sub::Name PROTOTYPES: DISABLE @@ -60,16 +68,20 @@ subname(name, sub) if (CvPADLIST(cv)) { /* cheap way to refcount the gv */ av_store((AV *) AvARRAY(CvPADLIST(cv))[0], 0, (SV *) gv); - } + } else #endif - else { + { /* expensive way to refcount the gv */ MAGIC *mg = SvMAGIC(cv); while (mg && mg->mg_virtual != &subname_vtbl) mg = mg->mg_moremagic; - if (!mg) - mg = sv_magicext((SV *) cv, NULL, PERL_MAGIC_ext, - &subname_vtbl, NULL, 0); + if (!mg) { + Newz(702, mg, 1, MAGIC); + mg->mg_moremagic = SvMAGIC(cv); + mg->mg_type = PERL_MAGIC_ext; + mg->mg_virtual = &subname_vtbl; + SvMAGIC_set(cv, mg); + } if (mg->mg_flags & MGf_REFCOUNTED) SvREFCNT_dec(mg->mg_obj); mg->mg_flags |= MGf_REFCOUNTED; diff --git a/README b/README index 422e7bc..11e62e6 100644 --- a/README +++ b/README @@ -1,6 +1,4 @@ -$Id: README,v 1.5 2004/08/18 17:53:45 xmath Exp $ - -Sub::Name 0.01 +Sub::Name 0.04 To install this module type the following: @@ -41,6 +39,6 @@ DESCRIPTION AUTHOR Matthijs van Duin - Copyright (C) 2004 Matthijs van Duin. All rights reserved. This program - is free software; you can redistribute it and/or modify it under the - same terms as Perl itself. + Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. This + program is free software; you can redistribute it and/or modify it under + the same terms as Perl itself. diff --git a/lib/Sub/Name.pm b/lib/Sub/Name.pm index 9d9b757..cae03fe 100644 --- a/lib/Sub/Name.pm +++ b/lib/Sub/Name.pm @@ -1,5 +1,3 @@ -# $Id: Name.pm,v 1.5 2004/08/18 17:53:45 xmath Exp $ - package Sub::Name; =head1 NAME @@ -35,7 +33,7 @@ can be very useful for debugging. Matthijs van Duin -Copyright (C) 2004 Matthijs van Duin. All rights reserved. +Copyright (C) 2004, 2008 Matthijs van Duin. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. @@ -46,7 +44,7 @@ use 5.006; use strict; use warnings; -our $VERSION = '0.03'; +our $VERSION = '0.04'; use base 'Exporter'; use base 'DynaLoader'; diff --git a/t/smoke.t b/t/smoke.t index 27d843c..87508ed 100644 --- a/t/smoke.t +++ b/t/smoke.t @@ -26,5 +26,4 @@ for (4 .. 5) { print $x->() eq "Blork::Dynamic $_" ? "ok $_\n" : "not ok $_\n"; } -# $Id: smoke.t,v 1.4 2004/08/18 12:03:42 xmath Exp $ # vim: ft=perl