Attached is a quick-and-dirty patch to implement $ENV{SCRIPT_FILENAME}
-- Chris
diff -ur WWW-Mechanize-CGI-0.2-orig/lib/WWW/Mechanize/CGI.pm WWW-Mechanize-CGI-0.2/lib/WWW/Mechanize/CGI.pm
--- WWW-Mechanize-CGI-0.2-orig/lib/WWW/Mechanize/CGI.pm 2005-11-02 15:02:56.000000000 -0600
+++ WWW-Mechanize-CGI-0.2/lib/WWW/Mechanize/CGI.pm 2005-11-21 08:23:08.000000000 -0600
@@ -17,6 +17,7 @@
if ( @_ ) {
$self->{cgi} = shift;
+ $self->{cgiapp} = undef;
}
return $self->{cgi};
@@ -52,6 +53,7 @@
};
$self->cgi($cgi);
+ $self->{cgiapp} = $application;
}
sub fork {
@@ -99,7 +101,15 @@
$c->setup;
- eval { $self->cgi->() };
+ my $fn = $self->{cgiapp} ? $self->{cgiapp} : $ENV{SCRIPT_FILENAME};
+ {
+ local $ENV{SCRIPT_FILENAME};
+ if (defined $fn)
+ {
+ $ENV{SCRIPT_FILENAME} = $fn;
+ }
+ eval {$self->cgi->() };
+ }
$c->restore;