Skip Menu |

This queue is for tickets about the Pragmatic CPAN distribution.

Report information
The Basics
Id: 11837
Status: new
Priority: 0/
Queue: Pragmatic

People
Owner: Nobody in particular
Requestors: cpan [...] kevin.lebleu.info
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in:
  • 1.7
  • 1.6
Fixed in: (no value)



Subject: Fix for Perl 5.6+
Pragmatic 1.6 fails built in tests in perl v5.8.6 (and from CPAN testers, looks like it failed every version since 5.5.3). This appears to have been caused by a change in whether the arguments to import are modifiable. The attached patch corrects the error by changing the s// call to a substr to strip the dash off of arguments, so it no longer modifies the arguments. The attached patch also passes the correct arguments to Exporter::export_to_level, which was previously being passed undef instead of the $package argument passed to the import() call. Per the Exporter documentation, this parameter is not currently used. This eliminates the FIXME comment that was in the code. With the attached patch, all tests pass flawlessly in Perl 5.8.6, I have not tested other versions.
--- /tmp/Pragmatic.pm.orig 2005-03-10 12:48:49.282262400 -0600 +++ /tmp/Pragmatic.pm 2005-03-10 13:16:55.445515100 -0600 @@ -9,20 +9,14 @@ @ISA = qw (Exporter); # The package version, both in 1.23 style *and* usable by MakeMaker: -$VERSION = substr q$Revision: 1.6 $, 10; -my $rcs = ' $Id: Pragmatic.pm,v 1.6 1999/09/21 14:00:00 binkley Exp $ ' ; +$VERSION = sprintf "%d.%d", q$Revision: 1.8 $ =~ /(\d+)/g; +my $rcs = ' $Id: Pragmatic.pm,v 1.8 2005/03/10 14:00:00 caswk Exp $ ' ; sub import ($) { my $package = shift; - # WTF? The documentation for Exporter::export_to_level looks like - # this: $package->export_to_level (1, @_); but the source discards - # the second argument in the list, so I need to call it like this: - # $package->export_to_level (1, undef, @_). Report bug. --bko - # FIXME - - return $package->export_to_level (1, undef, @_) + return $package->export_to_level (1, $package, @_) if $package eq __PACKAGE__; my $warn = sub (;$) { @@ -38,11 +32,11 @@ }; my @imports = grep /^[^-]/, @_; - my @pragmata = map { s/^-//o; $_; } grep /^-/, @_; + my @pragmata = map { substr($_, 1); } grep /^-/, @_; # Export first, for side-effects (e.g., importing globals, then # setting them with pragmata): - $package->export_to_level (1, undef, @imports) + $package->export_to_level (1, $package, @imports) if @imports; for (@pragmata) {