freddo411 has asked for the wisdom of the Perl Monks concerning the following question:

I'm stumped. I've distilled my issue down to its simplest possible form (see below) and I'm still stumped. I'm writing a module, Bar.pm
package Bar; use strict; use Exporter; use vars qw(@ISA @Export $VERSION); @ISA = qw(Exporter); @Export = qw(&ff_error ); $VERSION = 1.00; ########################################### sub ff_error { my ($error,@error_fields) = @_; print "\n\n ERROR: $error @error_fields\n\n"; exit; } 1;
which is called by my program, foo.pl
#!/usr/local/bin/perl -w use strict; use Bar; &ff_error("die here");
Which when executed gives me:
./foo.pl Undefined subroutine &main::ff_error called at ./foo.pl line 6.
Please note that perl -V let's me know that @INC includes "." and my version is 5.00503.

Please save me from going crazy looking at this...!#$^@#^

-------------------------------------
Nothing is too wonderful to be true
-- Michael Faraday

Replies are listed 'Best First'.
Re: Simple issue with my Module
by converter (Priest) on Jun 18, 2003 at 22:30 UTC

    The array name you want to store your exports in is @EXPORT.

Re: Simple issue with my Module
by The Mad Hatter (Priest) on Jun 18, 2003 at 22:30 UTC
    Exporter uses @EXPORT not @Export. Change @Export to @EXPORT and it'll work like a charm.
Re: Simple issue with my Module
by Nkuvu (Priest) on Jun 18, 2003 at 22:34 UTC
    Question already answered, but you should note that the error was telling you exactly what was wrong. You never defined a subroutine ff_error in the main package -- that's what the main::ff_error meant. So obviously the scope of ff_error wasn't being exported properly. But even with the incorrect @Export array, you could have called Bar::ff_export and it would work.
Re: Simple issue with my Module
by freddo411 (Chaplain) on Jun 18, 2003 at 22:48 UTC
    Bingo.

    Thanks monks.

    -------------------------------------
    Nothing is too wonderful to be true
    -- Michael Faraday