Skip Menu |

This queue is for tickets about the Exporter-Simple CPAN distribution.

Report information
The Basics
Id: 7708
Status: open
Priority: 0/
Queue: Exporter-Simple

Owner: Nobody in particular
Requestors: nothingmuch [...]

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

Subject: Exporting subs to different package doesn't work
Download (untitled) / with headers
text/plain 547b
..., in 01generic.t, perhaps: { package Foo; use MyExport qw/askme $foo/; Test::More::is($foo, $main::foo, "\$foo was exported to Foo"); # works Test::More::is(eval { askme() }, main::askme(), "askme() was exported to Foo"); # doesn't work } If you turn on $Exporter::Verbose you'll see that Exporter is pushing stuff into main because the caller from the perspective of Exporter::Simple::INIT seems to be that. I think this is unresolvable unless Attribute::Simple starts giving BEGIN attrs the name of the sub they acted on.
Download (untitled) / with headers
text/plain 429b
I just hit this. It pretty much renders the module unusable. :( Here's a simple example. $ cat package Foo; use base qw(Exporter::Simple); sub foo :Exported { 42 } sub bar :Exportable { 23 } 1; $ cat test.plx use Foo; print foo(); { package Wibble; use Foo qw(bar); print bar(); } $ perl test.plx Can't locate class method 'main::foo' via package 'main' at /Users/schwern/tmp/test.plx line 2
Download (untitled) / with headers
text/plain 737b
Explaining problem to future visitors. If sub, that is loaded from a module, is executed when another module is loaded, it should be exported at BEGIN stage. And with Exporter::Simple it is impossible because it loads list of them on CHECK stage and imports them into target package on INIT stage. This behavior is caused by Attribute::Handlers, because it does not provide sub name/symbol at BEGIN stage. It provides coderef. I tried to receive name from ref using Sub::Identify, but received error "Can't locate object method "NAME" via package "B::SPECIAL" at C:/strawberry/perl/site/lib/Sub/ line 21." I think that problem also makes sub prototypes unavailable in target package. -- Alexandr Ciornii,

This service is sponsored and maintained by Best Practical Solutions and runs on infrastructure.

Please report any issues with to