Update to 0.09

- New upstream release 0.09
  - Copy the contents of the %DB::sub entry if it exists; fixes
    Devel::NYTProf's anon sub handling (CPAN RT#50524)
- Drop upstreamed debugger patch
- Drop EL-5 compatibility since we need Devel::CheckBin, which can't be
  built for EPEL-5 or EPEL-6
This commit is contained in:
Paul Howarth 2014-08-15 16:20:52 +01:00
parent 29a2d860de
commit 22c788140a
3 changed files with 12 additions and 112 deletions

View File

@ -1,92 +0,0 @@
Closes RT#50524
---
Name.xs | 34 ++++++++++++++++++++++++++++++++++
t/smoke.t | 18 +++++++++++++++++-
2 files changed, 51 insertions(+), 1 deletions(-)
diff --git a/Name.xs b/Name.xs
index f6d7bc2..89d2dd8 100644
--- a/Name.xs
+++ b/Name.xs
@@ -64,6 +64,40 @@ subname(name, sub)
Safefree(namepv);
name = end;
}
+
+ /* under debugger, provide information about sub location */
+ if (PL_DBsub && CvGV(cv)) {
+ HV *hv = GvHV(PL_DBsub);
+
+ char* new_pkg = HvNAME(stash);
+
+ char* old_name = GvNAME( CvGV(cv) );
+ char* old_pkg = HvNAME( GvSTASH(CvGV(cv)) );
+
+ int old_len = strlen(old_name) + strlen(old_pkg);
+ int new_len = strlen(name) + strlen(new_pkg);
+
+ char* full_name;
+ Newz(39, full_name, (old_len > new_len ? old_len : new_len) + 3, char);
+
+ strcat(full_name, old_pkg);
+ strcat(full_name, "::");
+ strcat(full_name, old_name);
+
+ SV** old_data = hv_fetch(hv, full_name, strlen(full_name), 0);
+
+ if (old_data) {
+ strcpy(full_name, new_pkg);
+ strcat(full_name, "::");
+ strcat(full_name, name);
+
+ SvREFCNT_inc(*old_data);
+ if (!hv_store(hv, full_name, strlen(full_name), *old_data, 0))
+ SvREFCNT_dec(*old_data);
+ }
+ Safefree(full_name);
+ }
+
gv = (GV *) newSV(0);
gv_init(gv, stash, name, s - name, TRUE);
diff --git a/t/smoke.t b/t/smoke.t
index 87508ed..a383789 100644
--- a/t/smoke.t
+++ b/t/smoke.t
@@ -1,11 +1,15 @@
#!/usr/bin/perl
-BEGIN { print "1..5\n"; }
+BEGIN { print "1..10\n"; $^P |= 0x210 }
use Sub::Name;
my $x = subname foo => sub { (caller 0)[3] };
+my $line = __LINE__ - 1;
+my $file = __FILE__;
+my $anon = $DB::sub{"main::__ANON__[${file}:${line}]"};
+
print $x->() eq "main::foo" ? "ok 1\n" : "not ok 1\n";
@@ -26,4 +30,16 @@ for (4 .. 5) {
print $x->() eq "Blork::Dynamic $_" ? "ok $_\n" : "not ok $_\n";
}
+print $DB::sub{"main::foo"} eq $anon ? "ok 6\n" : "not ok 6\n";
+
+for (4 .. 5) {
+ print $DB::sub{"Blork::Dynamic $_"} eq $anon ? "ok ".($_+3)."\n" : "not ok ".($_+3)."\n";
+}
+
+my $i = 9;
+for ("Blork:: Bar!", "Foo::Bar::Baz") {
+ print $DB::sub{$_} eq $anon ? "ok $i\n" : "not ok $_ \n";
+ $i++;
+}
+
# vim: ft=perl
--
1.7.0.4

View File

@ -1,20 +1,15 @@
# TODO: BR: perl(B::C) when available
# Only need manual requires for "use base XXX;" prior to rpm 4.9
%global rpm49 %(rpm --version | perl -p -e 's/^.* (\\d+)\\.(\\d+).*/sprintf("%d.%03d",$1,$2) ge 4.009 ? 1 : 0/e')
Name: perl-Sub-Name
Version: 0.08
Release: 2%{?dist}
Version: 0.09
Release: 1%{?dist}
Summary: Name - or rename - a sub
License: GPL+ or Artistic
Group: Development/Libraries
URL: http://search.cpan.org/dist/Sub-Name/
Source0: http://search.cpan.org/CPAN/authors/id/E/ET/ETHER/Sub-Name-%{version}.tar.gz
Patch0: Sub-Name-0.08-cpan50524.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
BuildRequires: perl
BuildRequires: perl(base)
BuildRequires: perl(Devel::CheckBin)
BuildRequires: perl(DynaLoader)
BuildRequires: perl(Exporter)
BuildRequires: perl(ExtUtils::MakeMaker)
@ -22,10 +17,6 @@ BuildRequires: perl(strict)
BuildRequires: perl(Test::More)
BuildRequires: perl(warnings)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
%if ! %{rpm49}
Requires: perl(DynaLoader)
Requires: perl(Exporter)
%endif
# Don't "provide" private perl objects
%{?perl_default_filter}
@ -40,15 +31,11 @@ by the new name (without some deep magic).
%prep
%setup -q -n Sub-Name-%{version}
# Copy the contents of the %%DB::sub entry if it exists (CPAN RT#50524)
%patch0 -p1
%build
perl Makefile.PL INSTALLDIRS=vendor optimize="%{optflags}"
make %{?_smp_mflags}
%install
rm -rf %{buildroot}
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
@ -57,9 +44,6 @@ find %{buildroot} -type f -name '*.bs' -size 0 -exec rm -f {} \;
%check
make test
%clean
rm -rf %{buildroot}
%files
%doc Changes README
%{perl_vendorarch}/auto/Sub/
@ -67,6 +51,14 @@ rm -rf %{buildroot}
%{_mandir}/man3/Sub::Name.3pm*
%changelog
* Mon Aug 18 2014 Paul Howarth <paul@city-fan.org> - 0.09-1
- Update to 0.09
- Copy the contents of the %%DB::sub entry if it exists; fixes
Devel::NYTProf's anon sub handling (CPAN RT#50524)
- Drop upstreamed debugger patch
- Drop EL-5 compatibility since we need Devel::CheckBin, which can't be
built for EPEL-5 or EPEL-6
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.08-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

View File

@ -1 +1 @@
45beca98589be182a87aa7fdd15045ef Sub-Name-0.08.tar.gz
24f2fadd4e4c42907cfcd7c03ee8f4c8 Sub-Name-0.09.tar.gz