Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^6: global var

by tultalk (Monk)
on Apr 06, 2017 at 21:46 UTC ( #1187354=note: print w/replies, xml ) Need Help??

in reply to Re^5: global var
in thread global var

our $LoggedOn_user_id = 0;

Initializing variable. Later modified with data I want to share to other unit,

Unit? Module? same difference, is it not?

No on the var names being duplicated. Did multiple searches. Only one declaration with values loaded at different locations in program.

This whole program is for a landlord association. Member logs on. Drill down to their status which is loaded into dataset displayed on form (using their unique id passed with $LoggedOn_user_id to the unit generating/displaying dataset. Display includes the number of tenants associated with this member. Next step is to drill down with click on that number to pull up another dataset of all tenants to display.

When I manually set value in calling unit:

#$userid_1 = manageusers::LoggedOn_user_id; #$userid_1 = $manageusers::LoggedOn_user_id; #$userid_1 = $LoggedOn_user_id; $userid_1 = 428;

It of course works fine.

Have another global

$adminaccess = ($username1 eq "admin");

To activate/inactivate menu items depending on login status using javascript in webpage. Logout succeeded form into iFrame deactivates menu through messaging.

<script type="text/javascript"> var adminflag = $manageusers::adminaccess; </script>

Passing variables not new.

Replies are listed 'Best First'.
Re^7: global var
by poj (Abbot) on Apr 07, 2017 at 13:29 UTC
    Unit? Module? same difference, is it not?

    Sorry to be so pedantic but it may be relevant to solving your problem. When you said in your post

    I have global var in main unit:
    @EXPORT = qw( $LoggedOn_user_id $VERSION = '0.0.1'; } our $LoggedOn_user_id;
    do you mean that code is in the 'main' part of package manageusers. At the top maybe before the subroutines declaration ?


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1187354]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (8)
As of 2023-11-29 19:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found