
abockover
Deleted
Jul 13, 2000, 2:56 PM
Post #5 of 7
(1393 views)
|
|
Re: Call Subs from external Form or url
[In reply to]
|
Can't Post
|
|
Replying to reply #3 [monocle] It works half way, I mean, the output is reversed. Below is the exact code that is in test.pl on my server. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> #!/usr/bin/perl if ($FORM{'action'} eq "CallSub"){ &CallSub; } else { print "Content-type: text/html\n\n"; print "This is the main program.<br>Click <a href=\"test.pl?action=CallSub\">here</a> to enter the sub <address>CallSub</address>.\n"; } sub CallSub { print "Content-type: text/html\n\n"; print "This is the sub <address>CallSub</address>. If you are looking at this, it works!"; } @pairs = split(/&/,$ENV{'QUERY_STRING'}); foreach $pair (@pairs) { ($name,$value) = split(/=/,$pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $FORM{$name} = $value; } </pre><HR></BLOCKQUOTE> Visit http://www.crevasoft.com/cgi-bin/test.pl to see what I mean. Then, go to http://www.crevasoft.com/cgi-bin/test.pl?action=CallSub The output is reversed! What is wrong? Thanks Aaron
|