
swechsler
Novice
Aug 31, 2011, 9:55 AM
Post #1 of 7
(2380 views)
|
module doesn't see functions in required file
|
Can't Post
|
|
When I call a function (in this case, dump_change_network_settings() ) in a package, it doesn't see the functions within a file that's been REQUIREd. The module starts like this:
package DBA::ChangeNetworkSettings; use strict; use DBA::Stack; use Data::Dumper; require Exporter; require "/dba/shared/bin/dba_subs.pl"; our @ISA = qw(Exporter); our @EXPORT = qw(dump_change_network_settings); [..] sub dump_change_network_settings($$) { # Change network timeout settings before/after dump # option: 0 - reset, 1 - set my ($mysql, $option) = @_; my $dbh = $mysql->connect(); dba_debug(1, "In dump_change_network_settings()"); The dba_debug function is defined within dba_subs.pl:
sub dba_debug { my ($debug_level, $string) = @_; return unless my $debug = $ENV{DEBUG}; if ($debug >= $debug_level) { print STDERR "$string\n"; } } dump_change_network_settings() is called by the main script. When I run it, I get the following error: Undefined subroutine &DBA::ChangeNetworkSettings::dba_debug called at /dba/mysql/shared/lib/DBA/DBA/ChangeNetworkSettings.pm line 28. Interestingly, dba_subs is REQUIREd by another module here (written by someone else) and it works fine. I've compared that module with mine and can't see what's being done differently. Help! Thanks!
|