in reply to Why should I use Exporter?

Here's a real-life case where Exporter was useful to me:
BEGIN { if ($^O =~ /Win/) { eval "use Tricky_Win;" } else { eval "use Tricky_Linux;" } }
I made two portability modules, each exporting the same function names. Then the rest of the code can use the exported functions without worrying about where they came from.

Replies are listed 'Best First'.
Re^2: Why should I use Exporter? (if.pm)
by Aristotle (Chancellor) on Jun 18, 2003 at 22:05 UTC
    Since Perl 5.8, the if module is in the core. With it you can write this like
    use if $^O =~ /Win/, q(Tricky_Win); use if $^O !~ /Win/, q(Tricky_Linux);

    Makeshifts last the longest.