
miller
User
May 5, 2011, 10:55 AM
Post #7 of 8
(858 views)
|
|
Re: [FishMonger] Subs not exporting in module
[In reply to]
|
Can't Post
|
|
Fishmonger has this one right. Use 'our' to declare your package varibles, not 'my'.
package Resources; require "dba_subs.pl"; use Exporter; our @EXPORT = qw(acquire_resource free_resource check_resource); our $VERSION = "1.0"; use strict; use warnings; our $resource_instance = "live-nydba-01"; our $resource_db = "scheduler"; our $resource_user = "dba_query"; our $dbh; sub acquire_resource($$$$$;) { Also, I would strongly discourage you from using a sub with 5 parameters like that. Anytime you have more than 2 parameters, you should use a hash instead.
acquire_resource( param1 => 'val1', param2 => 'val2', param3 => 'val3', param4 => 'val4', param5 => 'val5', ); Then you can use something like Params::Validate to validate the parameters. http://search.cpan.org/~drolsky/Params-Validate-0.98/lib/Params/Validate.pm - Miller
|