Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^9: global var

by Anonymous Monk
on Apr 07, 2017 at 23:23 UTC ( [id://1187441]=note: print w/replies, xml ) Need Help??


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

...Other functions/.scalars are exported just fine. Not this one!!!

Then it shouldn't be too hard to duplicate that error in 20 lines, and post it here, right?

Replies are listed 'Best First'.
Re^10: global var
by tultalk (Monk) on Apr 08, 2017 at 02:02 UTC

    A previous comment posted code as you suggest. It worked fine when I tested it. I have something screwed up somehow and I can't see it.

    Posting question here was hoping for some insight as to why something like this may be occurring.

    These are two declarations (same location in manageusers just before first function definition.

    our $adminaccess = 0; our $LoggedOn_user_id = 0;

    As I said in an earlier response, I can grab $adminaccess in javascript in html page.

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

      Declaration: our $LoggedOn_user_id = 0;

      This is line from error log (warns):

      $LoggedOn_user_id = $username1; warn("Already logged on LoggedOn_user_id : '$LoggedOn_user_id'");

      Already logged on LoggedOn_user_id : '428' at /home/jalamior/www/httpsdocs/cgi-bin/lib/perl/manageusers.pm line 287.

      And in the other unit

      use manageusers qw(LoggedOn_user_id);

      Tried different variations of qw(LogggedOn.. and qw($LoggedOn.. Neither worked.

      $userid_1 = $LoggedOn_user_id; warn("userid : '$userid_1' ");

      What I get back is

      <h1>Software error:</h1> <pre>&quot;LoggedOn_user_id&quot; is not exported by the manageusers m +odule Can't continue after import errors at update_tables-development.cgi li +ne 30 BEGIN failed--compilation aborted at update_tables-development.cgi lin +e 30. </pre>

      Mangeusers export

      BEGIN { require Exporter; use vars qw($VERSION @ISA @EXPORT_OK); use DBI; # use vars qw(@ISA @EXPORT_OK); # $ENV{DBI_TRACE}=1; # $ENV{PERL_DBI_DEBUG}=1; @ISA = qw(Exporter); # exported functions our @EXPORT_OK = qw( &OpenConnection &OpenSession &ProcessLoginRequest &ProcessLostDataRequest &LoginUser $LoggedOn_user_id &decodeEncryptedPassName &UpdateUserData &GetUserLostData &LogoutUser &GetUserSessionCookie &CheckForAuthorizedUser &Expires $attempts $adminaccess &Now &CheckValidLoginChar &CheckValidEmailChar &print_md5_javascript); $VERSION = '0.0.1'; }

      Before I was led to use EXPORT_OK. I was at least getting zero in $userid_1

      $userid_1 = $LoggedOn_user_id; warn("userid : '$userid_1' ");
        And in the other unit

        Is this 'unit' the script update_tables-development.cgi or another package ?

        Tried different variations of qw(LogggedOn.. and qw($LoggedOn.. Neither worked.

        Why the .. ? now I'm guessing what you tried.
        If you tried LogggedOn_user_id then obviously that won't work with 3 g's in it

        If you tried LoggedOn_user_id did you have LoggedOn_user_id in @EXPORT_OK? The code shows only $LoggedOn_user_id which is a scalar not a method.

        If you tried $LoggedOn_user_id what error did you get ? I assume the error shown LoggedOn_user_id is not exported by the manageuser relates to the previous try with LoggedOn_user_id
        poj

        :)

        You know how people keep asking you to do the same thing ?

        And they ask again and again and again?

        And you never quite do exactly what they're asking?

        And even when the problem was solved two days ago, you still can't see it?

        The two things are connected

        Now, can you or can you not post 20 lines of code that runs and reproduces the problem (self-contained bug report)?

        No error logs, no fragments, just a small/short, self-contained program, which demonstrates the bug/problem?

        See if you follow the guidelines of How do I post a question effectively?, , and create the "20 line bug report", we can better help you, and you can believe us when we do :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-19 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found