[Catalyst-commits] r12533 - in trunk/Catalyst-Engine-HTTP-Prefork:
. lib/Catalyst/Engine/HTTP/Prefork
hobbs at dev.catalyst.perl.org
hobbs at dev.catalyst.perl.org
Wed Jan 6 01:12:09 GMT 2010
Author: hobbs
Date: 2010-01-06 01:12:08 +0000 (Wed, 06 Jan 2010)
New Revision: 12533
Modified:
trunk/Catalyst-Engine-HTTP-Prefork/Makefile.PL
trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm
Log:
Attempt to fallback to CGI::Simple::Cookie if CGI::Cookie::XS is unavailable
and relax the CGI::Cookie::XS dep on Win32 until that module is fixed.
Modified: trunk/Catalyst-Engine-HTTP-Prefork/Makefile.PL
===================================================================
--- trunk/Catalyst-Engine-HTTP-Prefork/Makefile.PL 2010-01-06 00:59:17 UTC (rev 12532)
+++ trunk/Catalyst-Engine-HTTP-Prefork/Makefile.PL 2010-01-06 01:12:08 UTC (rev 12533)
@@ -4,7 +4,9 @@
all_from 'lib/Catalyst/Engine/HTTP/Prefork.pm';
requires 'Catalyst::Runtime' => '5.7012';
-requires 'CGI::Cookie::XS' => '0.17';
+unless ($^O eq 'Win32') {
+ requires 'CGI::Cookie::XS' => '0.17';
+}
requires 'HTTP::Body' => '1.01';
requires 'Net::Server' => '0.97';
requires 'HTTP::HeaderParser::XS' => '0.20';
Modified: trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm
===================================================================
--- trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm 2010-01-06 00:59:17 UTC (rev 12532)
+++ trunk/Catalyst-Engine-HTTP-Prefork/lib/Catalyst/Engine/HTTP/Prefork/Handler.pm 2010-01-06 01:12:08 UTC (rev 12533)
@@ -3,7 +3,19 @@
use strict;
use base 'Catalyst::Engine::CGI';
-use CGI::Cookie::XS;
+our $COOKIE_CLASS;
+BEGIN {
+ eval {
+ # Much faster than CGI::Simple::Cookie but may be unavailable on win32.
+ require CGI::Cookie::XS;
+ $COOKIE_CLASS = 'CGI::Cookie::XS';
+ };
+ if ($@) {
+ require CGI::Simple::Cookie;
+ $COOKIE_CLASS = 'CGI::Simple::Cookie';
+ }
+}
+
use Data::Dump qw(dump);
use HTTP::Body;
use HTTP::Date qw(time2str);
@@ -42,9 +54,7 @@
my ( $self, $c ) = @_;
if ( my $header = $c->request->header('Cookie') ) {
- # This method is around 8x faster than letting
- # CGI::Simple::Cookie do the parsing in pure perl
- my $cookies = CGI::Cookie::XS->parse( $header );
+ my $cookies = $COOKIE_CLASS->parse( $header );
my $cookie_objs = {
map {
$_ => bless {
More information about the Catalyst-commits
mailing list