Skip to content

Instantly share code, notes, and snippets.

@beppu
Created January 5, 2010 22:58
Show Gist options
  • Select an option

  • Save beppu/269826 to your computer and use it in GitHub Desktop.

Select an option

Save beppu/269826 to your computer and use it in GitHub Desktop.
If a .psgi file and a .cgi file use the same .pm that happens to have an exit in it, CGI::Compile won't catch the exit.
#!/usr/bin/env perl
use common::sense;
use Plack::App::CGIBin;
warn "curl http://127.0.0.1:5000/problem.cgi\n";
# If both the .psgi file and a .cgi file uses
# a module with an exit statement in it, CGI::Compile's fake exit
# doesn't get called.
#
# Comment out the following line to make the problem go away.
use Problem;
my $cgi_bin = Plack::App::CGIBin->new(root => '.')->to_app;
#!/usr/bin/env perl
use Problem;
use CGI;
my $q = CGI->new;
print $q->header;
Problem::main;
package Problem;
sub main {
print "The following exit does not get caught.\n";
exit;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment