Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Sub-Uplevel CPAN distribution.

Report information
The Basics
Id: 40684
Status: resolved
Priority: 0/
Queue: Sub-Uplevel

People
Owner: Nobody in particular
Requestors: dagolden [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Sub::Uplevel-0.2002: bug with Exporter
Date: Wed, 5 Nov 2008 09:07:38 -0500
To: bug-Sub-Uplevel [...] rt.cpan.org
From: "David Golden" <dagolden [...] cpan.org>
Show quoted text
---------- Forwarded message ---------- From: Alex Efros <powerman@powerman.name> Date: Wed, Nov 5, 2008 at 7:45 AM Subject: Sub::Uplevel-0.2002: bug with Exporter To: David A Golden <dagolden@cpan.org> Hi! Looks like it's impossible to uplevel Exporter::import(). Thus result in workaround in my code: local $Exporter::ExportLevel = $level + 1; uplevel $level, $import, ($pkg, @p); I've attached example environment for this bug. Save files as: ./uplevel_bug.pl ./X/Importer.pm ./X/Manual.pm ./X/ExportAttrs.pm ./X/Exporter.pm and run uplevel_bug.pl. You'll see: func1=1 func2=2 Undefined subroutine &main::func3 called at ./uplevel_bug.pl line 14. but if you uncomment 'local $Exporter::ExportLevel' line in X/Importer.pm it will work correctly: func1=1 func2=2 func3=3 -- WBR, Alex.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

Message body is not shown because sender requested not to inline it.

On Wed Nov 05 09:08:02 2008, DAGOLDEN wrote: Show quoted text
> and run uplevel_bug.pl. You'll see: > > func1=1 > func2=2 > Undefined subroutine &main::func3 called at ./uplevel_bug.pl line 14. > > but if you uncomment 'local $Exporter::ExportLevel' line in X/Importer.pm > it will work correctly: > > func1=1 > func2=2 > func3=3
It works fine for me. I get the second output, even with the line commented out. Can you confirm that you have Sub::Uplevel 0.2002 installed? And please double check with exactly the files you uploaded to this ticket? -- David
Aha! It works fine on Perl 5.10.0 but is broken on 5.8.8. That suggests a problem with Exporter.pm in 5.8.8. Perhaps there's a workaround to make Sub::Uplevel work anyway. -- David
This is a tricky issue because it relates to *when* modules are loaded relative to when Sub::Uplevel is loaded. For example, "perl -MSub::Uplevel uplevel_bug.pl" will work fine. I've added the ":aggressive" import option to Sub::Uplevel 0.21_01 to forceably reload Exporter and Exporter::Heavy. If other modules prove similarly problematic, they can be added to the aggression list. Closing this ticket as it's not really a Sub::Uplevel bug anyway and the new ":aggressive" option is a passable workaround. -- David