R
rk
Hi,
I'm a beginner for perl/cgi programs and i tried to write a cgi script
and when i ran it, i got the following error. But when i verified it
from the book i typed exactly whatever it is there and i checked other
examples too. I did't get any clue.Can someone please help me on this.
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw( :standard );
print redirect( "http://localhost/cgi-bin/auto/submitReport.html")
unless para
m( "name" );
my $visitor_name = param("visitor_name");
my $visitor_email = param("visitor_email");
my $date = param( "date" );
my $time = param( "time" );
print header();
print start_html( -title => "Reports" );
if ( $visitor_name =~ /^\w+$/ ) {
print "<p>Name: \L\u$visitor_name.</p>";
}
if ($visitor_email = ~ /^\w+$/ ) {
print "<p>E-mail: \L\u$visitor_email.</p>";
}
if ( $date =~ m#^(1[012]|0?[1-9])/([012]?\d|3[01])/(\d\d)$# ) {
print "<p>Date: $1 / $2 / $3.</p>";
}
if ( $time =~ m#^(1[012]|[1-9])[0-5]\d)[0-5]\d)$# ) {
print "<p>Time: $1: $2: $3.</p>";
}
print end_html();
---------------
Here are the errors i got.
perl submitReport.pl
Status: 302 Moved
location: http://localhost/cgi-bin/auto/submitReport.html
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en-US"><head><title>Seahaven QA Status Reports</title>
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 22.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 26.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 30.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 34.
Thanks,
rk
I'm a beginner for perl/cgi programs and i tried to write a cgi script
and when i ran it, i got the following error. But when i verified it
from the book i typed exactly whatever it is there and i checked other
examples too. I did't get any clue.Can someone please help me on this.
#!/usr/bin/perl
use warnings;
use strict;
use CGI qw( :standard );
print redirect( "http://localhost/cgi-bin/auto/submitReport.html")
unless para
m( "name" );
my $visitor_name = param("visitor_name");
my $visitor_email = param("visitor_email");
my $date = param( "date" );
my $time = param( "time" );
print header();
print start_html( -title => "Reports" );
if ( $visitor_name =~ /^\w+$/ ) {
print "<p>Name: \L\u$visitor_name.</p>";
}
if ($visitor_email = ~ /^\w+$/ ) {
print "<p>E-mail: \L\u$visitor_email.</p>";
}
if ( $date =~ m#^(1[012]|0?[1-9])/([012]?\d|3[01])/(\d\d)$# ) {
print "<p>Date: $1 / $2 / $3.</p>";
}
if ( $time =~ m#^(1[012]|[1-9])[0-5]\d)[0-5]\d)$# ) {
print "<p>Time: $1: $2: $3.</p>";
}
print end_html();
---------------
Here are the errors i got.
perl submitReport.pl
Status: 302 Moved
location: http://localhost/cgi-bin/auto/submitReport.html
Content-Type: text/html; charset=ISO-8859-1
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"
"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
lang="en-US"><head><title>Seahaven QA Status Reports</title>
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 22.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 26.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 30.
Use of uninitialized value in pattern match (m//) at submitReport.pl
line 34.
Thanks,
rk