tultalk has asked for the wisdom of the Perl Monks concerning the following question:
HI I have global var in main unit:
@EXPORT = qw( $LoggedOn_user_id $VERSION = '0.0.1'; } our $LoggedOn_user_id; my $username1 = $session->param("username"); warn("username1 : '$username1'"); my $text = $username1; $text =~ m/(\d+)/; my $num = $1; warn("num: '$num'"); $LoggedOn_user_id = $num; warn("is already logged on loggedon_user_id : '$LoggedOn_user_id'");
Above code works fine. $username1 from session is jala428. $num shows 428 as does $LoggedOn_user_id.
In another unit I have: use manageusers;
my $userid = 0; $userid = $manageusers::LoggedOn_user_id;
$userid in this unit shows 0. I have another global same main unit and pulling vatiable in another unit and works fine. Exact same method.
I did searches in all files in cgi directory after change to $userid_1:
my $userid_1 = 0; $userid_1 = $manageusers::LoggedOn_user_id; warn("userid : '$userid_1' "); #$userid_1 = 428; my $uid = $userid_1; my $uid = $userid_1;
All hits same file in question. No others. Fails with $userid_1 = 0;
Any observations/suggestions appreciated
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: global var
by stevieb (Canon) on Apr 05, 2017 at 20:05 UTC | |
by tultalk (Monk) on Apr 05, 2017 at 20:51 UTC | |
by stevieb (Canon) on Apr 05, 2017 at 21:01 UTC | |
by tultalk (Monk) on Apr 05, 2017 at 21:18 UTC | |
by tultalk (Monk) on Apr 05, 2017 at 21:43 UTC | |
by shmem (Chancellor) on Apr 05, 2017 at 22:22 UTC | |
| |
by stevieb (Canon) on Apr 05, 2017 at 22:01 UTC | |
| |
by GotToBTru (Prior) on Apr 05, 2017 at 20:55 UTC | |
by Marshall (Canon) on Apr 06, 2017 at 13:27 UTC | |
by haukex (Archbishop) on Apr 06, 2017 at 14:08 UTC | |
by tultalk (Monk) on Apr 06, 2017 at 21:11 UTC | |
| |
by tultalk (Monk) on Apr 06, 2017 at 14:31 UTC | |
by poj (Abbot) on Apr 06, 2017 at 15:19 UTC | |
by Marshall (Canon) on Apr 06, 2017 at 14:54 UTC | |
by tultalk (Monk) on Apr 06, 2017 at 17:22 UTC | |
by Marshall (Canon) on Apr 08, 2017 at 03:14 UTC | |
| |
by poj (Abbot) on Apr 06, 2017 at 18:01 UTC | |
|