[Catalyst-commits] r12190 - in trunk/Catalyst-Controller-WrapCGI: .
lib/Catalyst/Controller lib/CatalystX
caelum at dev.catalyst.perl.org
caelum at dev.catalyst.perl.org
Fri Dec 4 21:10:55 GMT 2009
Author: caelum
Date: 2009-12-04 21:10:55 +0000 (Fri, 04 Dec 2009)
New Revision: 12190
Modified:
trunk/Catalyst-Controller-WrapCGI/Changes
trunk/Catalyst-Controller-WrapCGI/Makefile.PL
trunk/Catalyst-Controller-WrapCGI/README
trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/CGIBin.pm
trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/WrapCGI.pm
trunk/Catalyst-Controller-WrapCGI/lib/CatalystX/GlobalContext.pm
Log:
allow MyApp->foo methods in CGIs, release
Modified: trunk/Catalyst-Controller-WrapCGI/Changes
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/Changes 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/Changes 2009-12-04 21:10:55 UTC (rev 12190)
@@ -1,5 +1,9 @@
Revision history for Catalyst-Controller-WrapCGI
+0.021 2009-12-04 21:05:14
+ - better is_perl_cgi determination that also allows using MyApp->foo
+ methods
+
0.020 2009-06-30 22:59:56
- fix AUTHOR pod sections
Modified: trunk/Catalyst-Controller-WrapCGI/Makefile.PL
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/Makefile.PL 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/Makefile.PL 2009-12-04 21:10:55 UTC (rev 12190)
@@ -1,10 +1,10 @@
-use inc::Module::Install 0.87;
+use inc::Module::Install 0.91;
name 'Catalyst-Controller-WrapCGI';
all_from 'lib/Catalyst/Controller/WrapCGI.pm';
author 'Matt S. Trout <mst at shadowcat.co.uk>';
-requires 'Catalyst' => '5.80002';
+requires 'Catalyst' => '5.80015';
requires 'HTTP::Request::AsCGI' => '0.8';;
requires 'File::Find::Rule';
requires 'List::MoreUtils';
Modified: trunk/Catalyst-Controller-WrapCGI/README
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/README 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/README 2009-12-04 21:10:55 UTC (rev 12190)
@@ -1,6 +1,6 @@
Catalyst-Controller-WrapCGI
-Some modules to help you port mod_perl/CGI code to Catalyst.
+Some modules to help you port CGI/mod_perl code to Catalyst.
INSTALLATION
Modified: trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/CGIBin.pm
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/CGIBin.pm 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/CGIBin.pm 2009-12-04 21:10:55 UTC (rev 12190)
@@ -14,6 +14,7 @@
use List::MoreUtils 'any';
use IO::File ();
use Carp;
+use File::Temp 'tempfile';
use namespace::clean -except => 'meta';
@@ -23,11 +24,11 @@
=head1 VERSION
-Version 0.020
+Version 0.021
=cut
-our $VERSION = '0.020';
+our $VERSION = '0.021';
=head1 SYNOPSIS
@@ -208,18 +209,28 @@
sub is_perl_cgi {
my ($self, $cgi) = @_;
- my $shebang = IO::File->new($cgi)->getline;
+ my (undef, $tempfile) = tempfile;
- return 0 if $shebang !~ /perl/ && $cgi !~ /\.pl\z/;
+ my $pid = fork;
+ die "Cannot fork: $!" unless defined $pid;
- my $taint_check = $shebang =~ /-T/ ? '-T' : '';
+ if ($pid) {
+ waitpid $pid, 0;
+ my $errors = IO::File->new($tempfile)->getline;
+ unlink $tempfile;
+ return $errors ? 0 : 1;
+ }
+ # child
+ local *NULL;
open NULL, '>', File::Spec->devnull;
- my $pid = open3(gensym, '&>NULL', '&>NULL', "$^X $taint_check -c $cgi");
- close NULL;
- waitpid $pid, 0;
+ open STDOUT, '>&', \*NULL;
+ open STDERR, '>&', \*NULL;
+ close STDIN;
- $? >> 8 == 0
+ do $cgi;
+ IO::File->new(">$tempfile")->print($@);
+ exit;
}
=head2 wrap_perl_cgi
Modified: trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/WrapCGI.pm
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/WrapCGI.pm 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/lib/Catalyst/Controller/WrapCGI.pm 2009-12-04 21:10:55 UTC (rev 12190)
@@ -20,11 +20,11 @@
=head1 VERSION
-Version 0.020
+Version 0.021
=cut
-our $VERSION = '0.020';
+our $VERSION = '0.021';
=head1 SYNOPSIS
Modified: trunk/Catalyst-Controller-WrapCGI/lib/CatalystX/GlobalContext.pm
===================================================================
--- trunk/Catalyst-Controller-WrapCGI/lib/CatalystX/GlobalContext.pm 2009-12-04 20:41:13 UTC (rev 12189)
+++ trunk/Catalyst-Controller-WrapCGI/lib/CatalystX/GlobalContext.pm 2009-12-04 21:10:55 UTC (rev 12190)
@@ -15,11 +15,11 @@
=head1 VERSION
-Version 0.020
+Version 0.021
=cut
-our $VERSION = '0.020';
+our $VERSION = '0.021';
=head1 SYNOPSIS
More information about the Catalyst-commits
mailing list