ayapejian has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/pperl use strict; use CGI qw(:standard); use Switch; ###################################### # Setup our Variables my $myCGI = new CGI; my $parameters = $myCGI->Vars; # Holds the POST passed function name my $function = $parameters->{'function'}; ###################################### # This is the function request handler, it takes the 'function' argume +nt passed # in the POST and calls the correct function switch ( $function ) { case 'one' { print $myCGI->header(-type=>"text/html",-charset=>"UTF-8"); print $myCGI->start_html; funcOne(); } case 'two' { print $myCGI->header(-type=>"text/html",-charset=>"UTF-8"); print $myCGI->start_html; funcTwo(); } case 'three' { print $myCGI->header(-type=>"text/html",-charset=>"UTF-8"); print $myCGI->start_html; funcThree(); } else { print $myCGI->header(-type=>"text/html",-charset=>"UTF-8"); print $myCGI->start_html; print "Function not found"; } } sub funcOne(){ print "\nONE\n"; return( 1 ); } sub funcTwo(){ print "\nTWO\n"; return( 1 ); } sub funcThree(){ print "\nTHREE\n"; return( 1 ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Having trouble with pperl (Persistent Perl) and CGI
by perrin (Chancellor) on Apr 24, 2008 at 21:26 UTC | |
by Your Mother (Archbishop) on Apr 24, 2008 at 21:45 UTC | |
by blahblahblah (Priest) on Apr 25, 2008 at 00:16 UTC | |
by Anonymous Monk on Apr 24, 2008 at 22:16 UTC | |
by ayapejian (Novice) on Apr 25, 2008 at 12:13 UTC | |
|
Re: Having trouble with pperl (Persistent Perl) and CGI
by toolic (Bishop) on Apr 24, 2008 at 20:47 UTC |