CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Global symbol "$first_name" requires explicit package name at form2.cgi line 23.

 



02walshe
Novice

May 7, 2011, 5:29 PM

Post #1 of 3 (2093 views)
Global symbol "$first_name" requires explicit package name at form2.cgi line 23. Can't Post

Hi,

I'm having some real problems getting one of my scripts to work, and as far as I can see there's nothing wrong with it.

The error messages I'm getting are:


Code
syntax error at form2.cgi line 23, near "my " 
Global symbol "$first_name" requires explicit package name at form2.cgi line 23.
Global symbol "$first_name" requires explicit package name at form2.cgi line 37.
Execution of form2.cgi aborted due to compilation errors.


The errors are from this script:


Code
#!/usr/bin/perl 



# This is the website form script for processing of user data.
# This form is used to capture the user's details, sets them as variables, and then uses them to generate the next page for the user.
# This page is currently on Version: 0.2


# Use Strict to conform with all PERL language Rules
use strict;
# Load CGI standard variables
use CGI ':standard';
# Allow all EM's to be put to Browser (Disable during production enviroments)
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
print "Content-type: text/html\n\n";
warningsToBrowser(1);

use lib '/home/sites/website.com/cgi-bin';
require "BookPSW_Friend_Confirm.lib"

# Code to turn user's input into PERL variables for First User
my $first_name = param('firstname');
my $last_name = param('lastname');
my $email_address = param('emailaddress');
my $email_address_confirmation = param('emailaddressconfirmation');

# Code to turn user's input into PERL variables for friend
my $ffirst_name = param('friendfirstname');
my $flast_name = param('friendlastname');
my $femail_address = param('friendemailaddress');
my $femail_address_confirmation = param('friendemailaddressconfirmation');


# Code to generate the next page

&friendgeneratedpage($first_name,$last_name,$email_address,$ffirst_name,$flast_name,$femail_address);


yet my other script which is pretty much identical, works without any problems:


Code
#!/usr/bin/perl 



# This is the website form script for processingo of user data.
# This form is used to capture the user's details, sets them as variables, and then uses them to generate the next page for the user.
# This page is currently on Version: 0.2


# Use Strict to conform with all PERL language Rules
use strict;
# Load CGI standard variables
use CGI ':standard';
# Allow all EM's to be put to Browser (Disable during production enviroments)
use CGI::Carp qw(fatalsToBrowser warningsToBrowser);
print "Content-type: text/html\n\n";
warningsToBrowser(1);

use lib '/home/sites/website.com/cgi-bin';
require "BookPSW_Solo_Confirm.lib";

# Code to turn user's input into PERL variables for First User
my $first_name = param('firstname');
my $last_name = param('lastname');
my $email_address = param('emailaddress');
my $email_address_confirmation = param('emailaddressconfirmation');


# Code to generate the next page

&sologeneratedpage($first_name,$last_name,$email_address);


the website.com part points to the real website address on my server, but I've generalised it for privacy...


So, anyone any ideas? The variable is being set before being used, so I can't see what's going wrong...

thanks,

02walshe


shawnhcorey
Enthusiast


May 7, 2011, 6:37 PM

Post #2 of 3 (2090 views)
Re: [02walshe] Global symbol "$first_name" requires explicit package name at form2.cgi line 23. [In reply to] Can't Post

Try putting a smei-colon on the end of this statement:

Code
require "BookPSW_Friend_Confirm.lib"


When you get an error on a line that looks good to you, try looking a the line above for a missing semi-colon. Not that I never had this problem myself, it happen to a friend, yeah, that's a friend. :)

__END__

I love Perl; it's the only language where you can bless your thingy.

Perl documentation is available at perldoc.perl.org. The list of standard modules and pragmatics is available in perlmodlib.

Get Markup Help. Please note the markup tag of "code".


02walshe
Novice

May 9, 2011, 11:40 AM

Post #3 of 3 (2067 views)
Re: [shawnhcorey] Global symbol "$first_name" requires explicit package name at form2.cgi line 23. [In reply to] Can't Post

Ah! I see it now!

Thanks for that; I thought I was going mad...

Many Thanks!

02walshe

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives