Mar 6, 2014, 12:12 PM
Post #1 of 2
I'm Cross-posting this on DevShed and perlmonks for some more feedback. You never know when someone will have more information to jolt an idea. I got a good response on perlmonk and I see that it has to be re-written, just trying to be more incremental about it, theres alot to this app.
Stange Module behaviour
-------------- cut ------------
Hello, I've got a strange possibly obvious problem here. I'm trying to cleanup a perl application and I'm not getting the variable passed to another module for some reason. This thing is kind of a maze but its getting better. Heres a brief rundown:
use lib "lib";
### I tryed exporter here with no luck, maybe I did it wrong? ###
@ISA = qw(Exporter);
@EXPORT = qw($USERID);
print "Adding an Account";
&FIRST; ##a prior dev did this sub calling, its crap I know ###
&USERID; ##This sub takes user input ##
print "ID: $ID - UserID: $USERID \n"; ## All vars defined and as expected here ##
print "ID: $ID - USERID: $USERID \n";
### $ID is ok but $USERID is undefined ##
$USERID = Utility::Single_Input('Input Account Name', $USERID, $REQUIRED);
print "UserInput entered is $USERID \n";
Ok so a main program Mat.pl calls the Add.pm module which loads some variables from other subroutines and then calls another module, Group.pm . Right before it calls the other module both $ID and $USERID are defined and good. Once it gets into the Group module the $USERID variable is not defined, its just empty yet $ID seems ok. Whats going on here. Maybe I should add that the &USERID subroutine takes user input, but the user input is returned just fine to the Add_Acct sub and its defined right before the call to Groups.
What am I missing here?
(This post was edited by FishMonger on Mar 6, 2014, 1:01 PM)