in reply to Exporter question

Here's some code adapted from my Sub::Approx module which builds a list of all of the subroutines in a given package:

foreach (keys %{"${pkg}::"}) { my $glob = $::{$_}; $glob =~ s/^\*${pkg}:://; next unless defined &{"*${pkg}::$glob"}; push @subs, $glob; }

I guess it would be possible to run code like this in a BEGIN block and build up your @EXPORT array that way.

Update As tilly points out below, when a BEGIN block is executed none of the package's subroutines will have been defined. Therefore you should just put this code in the body of your package.

--
<http://www.dave.org.uk>

European Perl Conference - Sept 22/24 2000, ICA, London
<http://www.yapc.org/Europe/>

Replies are listed 'Best First'.
RE (tilly) 2: Exporter question
by tilly (Archbishop) on Aug 24, 2000 at 14:36 UTC
    The code is nice, but putting it in a BEGIN block probably won't work. Just put it in the body of the module.

    You want to have actually compiled your module before running that code (so the functions are defined), and run that before the person using your module imports stuff. Well the order of compilation is that they hit the use in their code, they call require, your code is compiled, your code is run, then they call import, then they continue compiling. So from their point of view, ordinary code in your module already is in a BEGIN block. :-)