in reply to Re: Re: Export all subs from a module
in thread Export all subs from a module
To do this in a way that doesn't export package vars as well (which I believe was davorg's objection), perhaps this would work:
@EXPORT_OK = grep {defined *{$MyPackage::{$_}}{CODE} } keys %MyPackage::;
And unless I'm very much mistaken, that line could just as well be at the top of your package as at the bottom: unless you're doing fancy run-time redefinition of subs, they should all be defined by the time the first line of non-begin-block code gets evaluated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Export all subs from a module
by andye (Curate) on Nov 01, 2001 at 17:46 UTC |