Perl failure with "main::$fn" used only once:" in error logs
Hi all,
Can anyone guess why this is happening? I am new to Perl, so please help me to fix this error:
- I have a static html file which calls the cgi-perl script.
HTML Code:
#!/usr/bin/perl -w
# Read the standard input (sent by the form):
read(STDIN, $form, $ENV{'CONTENT_LENGTH'});
# Get the name and value for each form input:
@pairs = split(/&/, $form);
# Then for each name/value pair....
foreach $pair (@pairs) {
# Separate the name and value:
($name, $value) = split(/=/, $pair);
# Convert + signs to spaces:
$value =~ tr/+/ /;
# Convert hex pairs (%HH) to ASCII characters:
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
# Store values in a hash called %FORM:
$form{$name} = $value;
}
#This will generate XHTML-compliant page headers
sub start_html()
{
print qq~
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> Cookies </title>
</head>
<body>
~;
}
if ($form{'submit'} eq "submit")
{
#Start hearders
print "Set-Cookie: name=$form{'name'}\n";
print "Content-Type: text/html\n\n";
#end of headers
&start_html();
print "Nice to meet you $form{'name'}", ". I hope to see you again soon";
}
else
{
$old_cookie = $ENV{"HTTP_COOKIE"};
#if cookie was found
if ($old_cookie)
{
($cookie_name, $name) = split(/=/, $old_cookie);
#start headers
print "Content-Type: text/html\n\n";
#end of headers
&start_html();
print "Hey! I know you dude! You are $name";
print "</body></html>\n";
}
#cookie not fond
else
{
# redirect user to the form with a redirect header
print "Location:http://mydomain.com/dude.html\n\n";
}
}
Error in log_error:
Code:
[client 10.10.192.168] Name "main::cookie_name" used only once: possible typo at /dir/cgi-bin/dude.pl line 49., referer: http://mydomain.com/dude.html
Last edited by bashily; 03-06-2013 at 01:10 AM..
Reason: Highlight line 49
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)
keep getting an error when I try to revert to a snapshot:
"VMDB Failure" followed by "Unable to open snapshot file"
Im using vmware server 1.0.4, host OS is windows xp and guest OS is SLES.
Is there anything I can do to recover the snapshot or am I in trouble!?!?! (0 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Ssh connections using shared public keys issue “authentication failure” messages, then succeed with “session opened”.
I have found a few other threads with similar issue, but no solutions offered. :wall:
How can I eliminate the failure messages?
Environment:
$ uname -a Linux... (0 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi 2 all,
i have had AIX 7.2
:/# /usr/IBMAHS/bin/apachectl -v
Server version: Apache/2.4.12 (Unix)
Server built: May 25 2015 04:58:27
:/#:/# /usr/IBMAHS/bin/apachectl -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_worker_module (static)
... (3 Replies)