[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Calling sub-routine



Hello Everyone:

Many many thanks to all of you for helping me out.  I am
amazed how
many perl gurus responded to my help.  It is far from being
complete.
I am trying to figure out the following:
====================================================
# Undefined subroutine &main::PrintHeader called.
File 'LC 2:MacPerl ƒ: formregistration.pl'; Line 4
====================================================
Apparently there seems to be some problem with the
subroutine.  I have
added to subroutine at the end.  One for saving the incoming
data and
the other for mailing confirmation.

I do not know how to proceed to the next step.

Regards

Amitava

#!/usr/local/bin/perl -w
push (@INC,"/usr/localbusiness/http/accn.com/cgi-bin");
use CGI qw(:standard :html3 -no_xhtml);
print &PrintHeader;

&ReadParse(*registration_data);
print << "HEAD";
<html>
<head>
<title>Aztec Registration Form</title>
</head>
<body>
HEAD

if (length($registration_data{"FirstName"}) > 0  &&
length($registration_data{"LastName"}) > 0) {
     print<<"EOP";
<h3>
Thank you $registration_data{"FirstName"}
$registration_data{"LastName"}
for registering your name with Aztec. You will now verify
the
information entered in the form. Please Correct if
necessary</h3>
EOP

     $Registration_Type = "Confirm Registration Data";
     print "<ul>";
     foreach $var ( keys (%registration_data) ) {
         if ( length($registration_data{"$var"} ) == 0) {
              print "<li>Your<em>$var</em>will be used to
help confirm
your order
              Please fill in the <em>$var</em>field";
         }#if
     }#for
     print "</ul>";
} else {
     $Registration_Type = "Submit Registration";           #
line 33
     if (defined($registration_data{"Phone Number"})) {
          $PhoneNumber=$registration_data{"Phone Number"};
     } else {
         $PhoneNumber="(999) 999-999";
     }#if

     print <<'TEST';
<hr noshade>
<center>
<Form Method=POST Action="/cgibook/regs.cgi">
<input type=hidden name=SavedName
value="registration_data{'FirstName'}$registration_data
{'LastName'}">
<table border=0 width=60%>
<caption align = top><h3>Aztec Registration
Form</h3></caption>    #line 46
<th ALIGN LEFT>First Name
<th ALIGN LEFT colspan=2>LastName<tr>
<td>
<input type=text size=32 maxlength=20
name="First Name" value=Registration data{"FirstName"}>
<td colspan=2>
<input type=text size=32 maxlength=40
name="Last Name" value=$registration_data{"LastName"} ><tr>
<th ALIGN=LEFT colspan=3>
  Street Address <td><td><tr>
<td colspan=3>
<input type=text size=61 maxsize=61
name"Street" value:$registration_data {'Street'}"><tr>
<th ALIGN LEFT>City
<th ALIGN LEFT>State
<th ALIGH LEFT>Zip <tr>
<td><input type =text sixe=20 maxlength=30
name=="City" value="$registration_data{'City'}">
<td><input type =text sixe=20 maxlength=20
name=="State" value="$registration_data{'State'}">
<td><input type =text size=5 maxlength=10
name=="Zip" value="$registration_data{'Zip'}"><tr>
<th ALIGN=LEFT  colspan=1>Phone Number
<th ALIGN=LEFT  colspan=2>E-Mail Address<tr>
<td colspan=1><input type=test size=15 maxlength=15
name="Phone Number" value="$PhoneNumber">
<td colspan=2><input type=test size=32 maxlength=32
name="E-Mail Address" value={"$EmailAddress"} ><tr>
<td width=50%><input type="submit" name="simple"
value=$Registration-Type>
<td width=50%><input type="reset"><tr>
</table>
</FORM>
</center>
<hr noshade>
</body>
</html>
TEST

}#if


sub save_registration_data{
local($regdata)  = @_;
if($regdata{'simple'} eq "Confirm Registration Data")
{
open(RegDataFile,
'<</usr/local/business/http/accn.com/cgibook/chap7/rdf') ||
die "cant open reg data file\n";
foreach $var (keys (%regdata))
{
print (RegDataFile "$var=$regdata{\"$var\"}:");
}
print "<br>";
}
}


sub mail_confirmation{
local($regdata)= @_;
$temp = "Thank you $regdata {'First Name'} $regdata {'Last
Name'} for
registering with Aztec.\n";
if ($regdata{'simple'} eq "Confirm Registration Data")
{
if ($regdata{'Email Address'} =~/[;><&\*`\|]/){
print "<hr><h4>The email address you submitted is
malformed.</h4>regdata{'Email Address'}<hr>";
}
else
{open (MAIL, "|mail $regdata {'Email Address'}")||
die "can't open mail programme\n";
print MAIL <<EOM;
$temp
Please verify the following information.
Your name and mailing address are:
$regdata{'First Name'} $regdata {'Last Name'}
$regdata{'Street'}
$regdata{'City'}, $regdata{'State'} $regdata{'Zip'}

Your Phone Number is $regdata{'Phone Number'}
EOM
}
}
}











# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org