Skip to content

Instantly share code, notes, and snippets.

@agleyzer
Created November 2, 2012 19:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agleyzer/4003771 to your computer and use it in GitHub Desktop.
Save agleyzer/4003771 to your computer and use it in GitHub Desktop.
mod_perl snafu
#!/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