Exporter with attributes?

Ovid on 2004-03-08T23:11:00

So there I was, trying to track down that bug, when I saw that there were two problems. The first was simple: @EXPORT had the sub listed, so naturally the sub I wanted wasn't going to be exported.

The second problem is a "metaproblem". Using Exporter requires that subs be defined in two places. From a documentation standpoint, it's very handy to pop open a module and see everything that's going to be exported. On the other hand, wouldn't the following be nice?

use Exporter::Attributes;

sub foo : Export {}
sub bar : Export_ok {}
sub baz : Export_tag(some_group) {}

Would you use it?


Sounds like...

rafael on 2004-03-08T23:24:00

Exporter::Simple.

Re:Sounds like...

Ovid on 2004-03-08T23:26:46

Of course it's been done ... it's too obvious :)

Re:Sounds like...

rafael on 2004-03-08T23:44:38

Good ideas are not so obvious, you know.

And see also...

Damian on 2004-03-09T03:02:52

...Perl6::Export for a (suspiciously familiar) take on how exporting will work in Perl 6.