Likeless has asked for the wisdom of the Perl Monks concerning the following question:
My large perl application suddenly started complaining that the variable %mycode_pegs was not defined. I'm not aware of having made changes to these files recently.
I added %mycode_pegs to a use vars() statement in an attempt to fix this. Although the module no longer complains of the hash being undefined, it no longer seems to be able to access its data.
Here are the tops of the relevant files:
mycode_payment.pm
#!/usr/bin/perl -- use warnings; package mycode_payment; require Exporter; @ISA = qw (Exporter); @EXPORT = qw(@EXPORT_OK); @EXPORT_OK = qw($dbh %form %session); use common qw(%form $dbh %session); use mycode; use mycode_config qw(%config); use mycode_pegs qw(%mycode_pegs); use mycode_create_orders; use mycode_forms; use mycode_includes; use site_config qw(%site_config); use Digest::MD5 qw(md5_hex); use Business::CreditCard; use strict; use vars qw($dbh %form %session %site_config %config %mycode_pegs); use mycode_payment_maxmind;
Lots of subroutines follow, making up the rest of this module.
mycode_payment_maxmind.pm
#!/usr/bin/perl -- use warnings; package mycode_payment; require Exporter; @ISA = qw (Exporter); @EXPORT = qw(@EXPORT_OK); @EXPORT_OK = qw($dbh %form %session); use common qw(%form $dbh %session); use mycode; use mycode_config qw(%config); use mycode_pegs qw(%mycode_pegs); use mycode_create_orders; use mycode_forms; use mycode_includes; use site_config qw(%site_config); use Digest::MD5 qw(md5_hex); use Business::MaxMind::CreditCardFraudDetection; use Business::MaxMind::TelephoneIdentitification; use Business::MaxMind::TelephoneVerification; use strict; use vars qw($dbh %form %session %site_config %config);
Lots of subroutines follow, making up the rest of this module.
mycode_pegs.pm
#!/usr/bin/perl -- use warnings; package mycode_pegs; require Exporter; @ISA = qw (Exporter); @EXPORT = qw(@EXPORT_OK); @EXPORT_OK = qw(%mycode_pegs); use strict; use common qw(%form $dbh %session); use common_config qw(%common_config); use site_config qw(%site_config); use mycode_config qw(%config); use mycode; use mycode_create_orders; use vars qw(%mycode_pegs);
Lots of keys and values of %mycode_pegs are now defined, making up the rest of this module. It is these values that are not accessible in mycode_payment_maxmind.pm any more for some reason.
These problems are happenning under Apache 1.x running mod_perl. The mod_perl startup script uses a lot of these modules too:
use mycode_config qw(%config); use mycode_pegs qw(%mycode_pegs); use mycode_includes(); use email_sellcart(); use mycode(); use mycode_admin(); use mycode_buylist(); use mycode_ccgateways(); use mycode_create_orders(); use mycode_forms(); use mycode_from(); use mycode_lang_ccverify(); use mycode_makemoney(); use mycode_newsletter(); use mycode_pages(); use mycode_payment(); use mycode_productentry(); use mycode_redflag(); use mycode_store(); use mycode_wish(); use mycode_actions_payment(); use mycode_payment_maxmind();
Can anyone suggest why the %mycode_pegs hash is not being exported into mycode_payment_maxmind.pm any more, and what I might be able to do to fix it?
Thank you.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash no longer being exported/imported between modules
by SuicideJunkie (Vicar) on Aug 27, 2009 at 20:09 UTC | |
|
Re: Hash no longer being exported/imported between modules
by jethro (Monsignor) on Aug 27, 2009 at 21:34 UTC |