in reply to Trouble Exporting a Function
However you should really put everything below (and including) the line package CART::Validate into a file of it's own (i.e Cart/Validate.pm in one of the paths in @INC) and then your use statement will work fine.use strict; use warnings; use diagnostics; use lib './lib'; ## was: use CART::Validate CART::Validate->import(); print qq(The module version is $CART::Validate::VERSION\n); my $testing = testMod(); print qq(The return value from testMod is $testing\n); exit; # CART::Validate package CART::Validate; BEGIN { use Exporter; our( @ISA, @EXPORT, @EXPORT_OK, $VERSION ); @ISA = qw( Exporter ); @EXPORT = qw( &testMod ); @EXPORT_OK = qw(); $VERSION = 1.00; } sub testMod { return "HELLO!"; } 1; __output__ The module version is 1 The return value from testMod is HELLO!
_________
broquaint
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Trouble Exporting a Function
by PodMaster (Abbot) on Mar 13, 2003 at 15:59 UTC | |
by broquaint (Abbot) on Mar 13, 2003 at 16:07 UTC | |
by PodMaster (Abbot) on Mar 13, 2003 at 16:11 UTC | |
Re: Re: Trouble Exporting a Function
by Rich36 (Chaplain) on Mar 13, 2003 at 18:27 UTC |