X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FTest.pm;h=3af0f151f677f318a863b412b9482e04597869c5;hb=8b76bfcf2b7d98cd72fc7ba702a15684bdee06f0;hp=023b8e51c1f7ec58b0f97131ead9c5687e68862a;hpb=68eb5874bcda8eed45d92481248a77533944671a;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Test.pm b/lib/Catalyst/Test.pm index 023b8e5..3af0f15 100644 --- a/lib/Catalyst/Test.pm +++ b/lib/Catalyst/Test.pm @@ -1,13 +1,31 @@ package Catalyst::Test; use strict; +use warnings; use Catalyst::Exception; use Catalyst::Utils; use UNIVERSAL::require; +use HTTP::Headers; $ENV{CATALYST_ENGINE} = 'Test'; +# Bypass a HTTP::Headers bug +{ + no warnings 'redefine'; + + sub HTTP::Headers::new { + my $class = shift; + my $self = bless {}, $class; + if (@_) { + while ( my ( $field, $val ) = splice( @_, 0, 2 ) ) { + $self->push_header( $field, $val ); + } + } + return $self; + } +} + =head1 NAME Catalyst::Test - Test Catalyst applications @@ -62,7 +80,7 @@ Returns the content. Returns a C object. - my $res =request('foo/bar?test=1'); + my $res = request('foo/bar?test=1'); =cut @@ -79,6 +97,7 @@ sub import { else { $class->require; + die if $@ && $@ !~ /^Can't locate /; $class->import; $request = sub { $class->run(@_) };