You pose a dilemma here. Short and sweet, no error. This part of code shows 0 or undefiend at <-------------------------------
#! /usr/bin/perl -w use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use strict; use diagnostics -verbose; use warnings; use CGI; use CGI qw(:standard escapeHTML); use CGI qw/:standard/; use lib qw(/usr/local/apache/lib/perl); use vars qw($dataupdatemessage $dataupdatefilemessage ); local ($CGI::DISABLE_UPLOADS, $CGI::POST_MAX); $CGI::DISABLE_UPLOADS = 0; # enable uploads Disable uploads $CGI::POST_MAX = 32 * 1024; # limit posts to 32K max<------NEED + TO LOOK AT THIS LIMIT use lib qw(/home/jalamior/www/httpsdocs/cgi-bin/lib/perl); #use lib qw(/srv/www/cgi-bin/lib/perl); use manageusers qw($LoggedOn_user_id); #Error Handling BEGIN { require 5.004; use CGI::Carp qw(fatalsToBrowser carpout); my $logfile = '/home/jalamior/public_html/httpsdocs/cgi-bin/logs/err +orLog/errorFile.log'; # open LOG, ">>$logfile" or die "Couldn't append to $logfile: $!\n"; # carpout(\*LOG); }; warn("Entered update_tables.cgi"); warn("update_tables.cgi before open connection"); #--------------------------------------------------------------------- +--------------------------- my $htmlMemberDownloadHeader='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML +4.01 Transitional//EN"><html><head><title>Member Data Download Form</ +title>'; my $htmlMemberDataFeedbackHeader='<!DOCTYPE HTML PUBLIC "-//W3C//DTD H +TML 4.01 Transitional//EN"><html><head><title>Member Data Update Feed +back Form</title>'; my $htmlTenantListingFormHeader='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HT +ML 4.01 Transitional//EN"><html><head><title>Tenant Listing Form</tit +le>'; my $htmlheader2 = '<meta https-equiv="Content-Type" content="text/html +;charset=iso-8859-1">'; my $htmlheader3 = '<link rel="StyleSheet" href="/graphics/jala_styles. +css" type="text/css">'; my $dbh = manageusers::OpenConnection(); warn("update_tables.cgi after open connection"); # Dispatch to proper action based on user selection my $count = 0; my $query = new CGI; my $cgiURL = CGI::url(); my $action = lc ($query->param('action')); my $userid_1 = 0; ############################################################### $userid_1 = $manageusers::LoggedOn_user_id; <------------------------- +-------- #$userid_1 = 110;
The other side of the interface boundary:
package manageusers; use strict; use diagnostics -verbose; use warnings; use CGI; #use Carp::Always; use CGI::Carp qw(fatalsToBrowser warningsToBrowser); use CGI qw(:standard escapeHTML); use CGI qw/:standard/; use Data::Dumper; use Digest::MD5 qw(md5_hex); #use DB_File; # persistent hash database use CGI::Session; use CGI::Cookie; #use vars qw($session_cookie1 $session_cookie2 $login_timeout); #use vars qw($session); use Mail::Sendmail; use Time::HiRes qw(usleep); use Time::Local; 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 &decodeEncryptedPassName &UpdateUserData &GetUserLostData &LogoutUser &GetUserSessionCookie &CheckForAuthorizedUser &Expires $LoggedOn_user_id $attempts $adminaccess &Now &CheckValidLoginChar &CheckValidEmailChar &print_md5_javascript); $VERSION = '0.0.1'; }
Exports the variable $LoggedOn_user_id
The error reported is that $LoggedOn_user_id is not exported by manageusrs.
The short test program does not display that error.
In my program on the defining side of the interface boundary, I declare our $LoggedOn_user_id = 0; so there clearly should be something to export.
And later I populate the variable with the desired data
my $username1 = $session->param("user_id"); warn("username1 : '$username1'"); $LoggedOn_user_id = $username1; warn("Already logged on LoggedOn_user_id : '$LoggedOn_user_id'");
And at that point, the desired information is in the variable.
In reply to Re^15: global var
by tultalk
in thread global var
by tultalk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |