Created
November 2, 2012 19:27
-
-
Save agleyzer/4003771 to your computer and use it in GitHub Desktop.
mod_perl snafu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/perl | |
use CGI qw/:standard/ ; | |
use strict; | |
# demonstration how mod_perl may screw up your naive CGI code... Call | |
# this script passing different name parameter several times. | |
my $name = param('name') || "professor"; | |
sub say_hi { | |
my $real_name = shift; | |
print "Hi there, $name"; | |
if ($name ne $real_name) { | |
print "... or should I call you $real_name?\n"; | |
} else { | |
print "!\n"; | |
} | |
} | |
print header('text/plain'); | |
say_hi($name); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment