homepage Welcome to WebmasterWorld Guest from 54.227.11.45
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
FormMail.pl problems from a newby
script generates error
rasen




msg:4119747
 12:54 am on Apr 22, 2010 (gmt 0)

I'm new to this forum so I hope someone here can help. I am using NMS FormMail.pl to read a form on my wife's website. The script generates the following error:

Global symbol "$url" requires explicit package name at (eval 5) line 68.
Global symbol "$url" requires explicit package name at (eval 5) line 68.
syntax error at (eval 5) line 86, near "validate_abs_url"
Global symbol "$url" requires explicit package name at (eval 5) line 86.
syntax error at (eval 5) line 88, near "}
else"
BEGIN failed--compilation aborted at FormMail.pl line 3268.

I'm using the .pl file directly from the NMS website. Here is the beginning of the file:

#! /usr/bin/perl -wT
#
# NMS FormMail Version 3.14c1
#

use strict;
use vars qw(
 $DEBUGGING $emulate_matts_code $secure %more_config
 $allow_empty_ref $max_recipients $mailprog @referers
 @allow_mail_to @recipients %recipient_alias
 @valid_ENV $date_fmt $style $send_confirmation_mail
 $confirmation_text $locale $charset $no_content
 $double_spacing $wrap_text $wrap_style $postmaster 
 $address_style
);

# PROGRAM INFORMATION
# -------------------
# FormMail.pl Version 3.14c1
#
# This program is licensed in the same way as Perl
# itself. You are free to choose between the GNU Public
# License <http://www.gnu.org/licenses/gpl.html> or
# the Artistic License
# <http://www.perl.com/pub/a/language/misc/Artistic.html>
#
# For help on configuration or installation see the
# README file or the POD documentation at the end of
# this file.

# USER CONFIGURATION SECTION
# --------------------------
# Modify these to your own settings. You might have to
# contact your system administrator if you do not run
# your own web server. If the purpose of these
# parameters seems unclear, please see the README file.
#
BEGIN
{
 $DEBUGGING   = 0;
 $emulate_matts_code= 0;
 $secure   = 1;
 $allow_empty_ref = 1;
 $max_recipients = 5;
 $mailprog   = '/usr/sbin/sendmail -oi -t';
 $postmaster  = '';
 @referers   = qw(www.example.com localhost);
 @allow_mail_to  = qw(example@example.net localhost);
 @recipients  = ();
 %recipient_alias = ();
 @valid_ENV   = qw(REMOTE_HOST REMOTE_ADDR REMOTE_USER HTTP_USER_AGENT);
 $locale   = '';
 $charset   = 'iso-8859-1';
 $date_fmt   = '%A, %B %d, %Y at %H:%M:%S';
 $style    = '/css/nms.css';
 $no_content  = 0;
 $double_spacing = 1;
 $wrap_text   = 0;
 $wrap_style  = 1;
 $address_style  = 0;
 $send_confirmation_mail = 0;
 $confirmation_text = <<'END_OF_CONFIRMATION';
From: you@your.com
Subject: form submission

Thank you for your form submission.

END_OF_CONFIRMATION

# You may need to uncomment the line below and adjust the path.
# use lib './lib';

# USER CUSTOMISATION SECTION
# --------------------------
# Place any custom code here<p># USER CUSTOMISATION << END >>
# ----------------------------
# (no user serviceable parts beyond here)
}


I've checked the permissions on the .pl file and it is set to 755. The file was downloaded using Fetch, in ASCII. I'm not a Perl programmer and have no idea what's wrong with the script. My service provider stated that the file paths for Perl and Sendmail were correct. Can someone please help me out here?

[edited by: tedster at 2:23 am (utc) on Apr 24, 2010]

 

phranque




msg:4119841
 5:27 am on Apr 22, 2010 (gmt 0)

welcome to WebmasterWorld [webmasterworld.com], rasen!

since you truncated your script you have excluded the part of the script that caused the errors.
flying blind we'll have to guess at possibilities.

in general, the "requires explicit package name" error message is caused when you specify the strict pragma ("use strict;") and haven't used the "my" function to declare local variables ("my ($url);").
it is possible that you have a cascade of errors where the undeclared local variable created the subsequent conditions for the other errors reported.

rasen




msg:4120065
 1:42 pm on Apr 22, 2010 (gmt 0)

Sorry the script is kind of large and I wasn't sure I could send all of it.

rasen




msg:4120071
 1:50 pm on Apr 22, 2010 (gmt 0)

I tried to send the entire script and I got the following error on my end:

Unable to connect to www.webmasterworld.com (72.3.232.139). This is most likely because the URL has been mis-typed or the server is down and no longer taking requests.

Maybe my side is blocking it or the the code is too large. Can I email it to you?

phranque




msg:4120325
 10:17 pm on Apr 22, 2010 (gmt 0)

the error messages gave you some line numbers.
you should only post the relevant part(s) of the script.

rasen




msg:4121132
 2:01 am on Apr 24, 2010 (gmt 0)

Problem has been resolved.

[edited by: phranque at 12:39 pm (utc) on Apr 24, 2010]

phranque




msg:4121274
 12:40 pm on Apr 24, 2010 (gmt 0)

do tell!
we are always interested in resolutions.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved