Subject: | BUG: Collectors are not exported |
Date: | Tue, 3 Mar 2009 17:51:56 +0100 |
To: | bug-Sub-Exporter [...] rt.cpan.org |
From: | Hynek Vychodil <hynek [...] gooddata.com> |
Hello,
It seems as bug for me.
I have simplified example in Sub::Exporter::Cookbook (
http://search.cpan.org/~rjbs/Sub-Exporter-0.982/lib/Sub/Exporter/Cookbook.pod
) altering importers @ISA to minimize test case:
--- subexpdemo.pm ---
package subexpdemo;
use Sub::Exporter -setup => {
collectors => { _become_plugin => \'_become_plugin' },
groups => [ plugin => ['_become_plugin'] ]
};
sub _become_plugin {
my ( $class, $value, $data ) = @_;
my $target = $data->{into};
push @{"$target\::ISA"}, $class->plugin_base_class;
}
1;
--- subexpdemo.pm ---
and my test script
--- subexpdemo.pl ---
use strict;
use warnings;
package Foo::Bar;
use subexpdemo '-plugin';
--- subexpdemo.pl ---
It throws.
"_become_plugin" is not exported by the subexpdemo module at log_test.pl
line 6
BEGIN failed--compilation aborted at subexpdemo.pl line 6.
I'm interested in it because I want generate function using 'into' value (
http://stackoverflow.com/questions/595662/how-can-i-easily-generate-a-function-depending-on-name-of-class-to-export-to
).
Even of this bug it seems not be solution for me. I can't protect to forgot
add '_become_plugin' like collector or group containing it include in import
parameters. I have peeped in source code and it seem that it will be easy
add `into` value to generator parameters. I hope that can provide patch if I
will not be too much busy.
Best regards
--
--Hynek (Pichi) Vychodil
Analyze your data in minutes. Share your insights instantly. Thrill your
boss. Be a data hero!
Try Good Data now for free: www.gooddata.com