Why are hash values missing?
#declare hash in main
my %myhash;
#require the autoloaded modules:
require ${modulename};
require ${usermodule};
#build the hash in an autoloaded module using a reference:
&{${modulename}.'::$modulename'}($param1,\%myhash,\%hash2);
#call another autoloaded module that wants to use the hash:
&{${usermodule}.'::$usermodule'}($param1,\%myhash,\$array);
#in $usermodule, keys to the hash exist:
@mykeys = keys %$hashref; # is non-empty array
#but any attempt to get hash values produces null. e.g.,
my $myval = ${hashref}->{$mykeys[0]};
I can print the keys and values just before calling the user module. But inside that module the keys exist while the values are null. The main perl script has grown over time, but this used to work.
Can this have something to do with size of compiled code?
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.