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.


In reply to Hash no longer being exported/imported between modules by Likeless

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.