# This file documents the revision history for Perl extension Catalyst.
+ Bug fixes:
+ - Fix reporting the wrong Content-Length if the response body is an
+ upgraded string. Strings mean the same thing whether or not they are
+ upgraded, may get upgraded even after they are encoded, and will
+ produce the same output either way, but bytes::length returns too big
+ values for upgraded strings containing characters >127
+ - Make FastCGI compatible with modules which use the fileno call to
+ determine if a file is open (E.g. IPC::Run)
+
+ Refactoring / cleanups:
+ - NoTabs and Pod tests moved to t/author so that they're not run
+ (and then skipped) normally.
+
+5.80014_01 2009-11-22 20:01:23
+
+ Bug fixes:
+ - Filehandle now forced to binmode in CGI and FastCGI engines. This appears
+ to correct some UTF-8 issues, but may break people's code which relies
+ on the old behaviour.
+
+ Refactoring / cleanups:
+ - Plugins which inherit from Catalyst::Controller or Catalyst::Component
+ are deprecated and now issue warnings.
+
+5.80014 2009-11-21 02:51:14
+
Bug fixes:
- Require MooseX::MethodAttributes 0.17. This in turn requires new
MooseX::Types to stop warnings in Moose 0.91, and correctly supports
- Improved the suggested fix warning when component resolution uses regex
fallback for fully qualified component names.
- Catalyst::Test::local_request sets ->request on the response.
- - Require HTTP::Request 5.814 and HTTP::Response 5.813 from LWP 5.814
- to avoid test fails.
- Log flush moved to the end of setup so that roles and plugins which
hook setup_finalize can log things and have them appear in application
startup, rather than with the first hit.
context.
- Pod fix in Catalyst::Request (RT#51490)
- Pod fixes to refer to ::Controller:: rather than ::C:: as the latter
- is deprecated (RT#51490)
+ is deprecated (RT#51489)
New features:
- Added disable_component_resolution_regex_fallback config option to
proper PATH_INFO and SCRIPT_NAME processing for non-root applications
- Enable Catalyst::Utils::home() to find home within Dist::Zilla built
distributions
+ - Added the Catalyst::Exception::Interface role defining the interface
+ exception classes need to implement.
+ - Added Catalyst::Exception::Basic as a basic implementation of
+ Catalyst::Exception::Interface and made the existing exception classes
+ use it.
Refactoring / cleanups:
- Remove documentation for the case_sensitive setting
requires 'Class::MOP' => '0.83';
requires 'Moose' => '0.90';
requires 'MooseX::MethodAttributes::Inheritable' => '0.17';
-requires 'MooseX::Role::WithOverloading';
+requires 'MooseX::Role::WithOverloading' => '0.03';
requires 'Carp';
requires 'Class::C3::Adopt::NEXT' => '0.07';
requires 'CGI::Simple::Cookie';
# NOTE - This is the version number of the _incompatible_ code,
# not the version number of the fixed version.
my %conflicts = (
+ 'Catalyst::Plugin::SubRequest' => '0.14',
'Catalyst::Model::Akismet' => '0.02',
'Catalyst::Component::ACCEPT_CONTEXT' => '0.06',
'Catalyst::Plugin::ENV' => '9999', # This plugin is just stupid, full stop
my $attr = $osx_ver =~ /^10.(5|6)/ ? 'COPYFILE_DISABLE' : 'COPY_EXTENDED_ATTRIBUTES_DISABLE';
makemaker_args(dist => { PREOP => qq{\@if [ "\$\$$attr" != "true" ]; then}.
- qq{ echo "You must set the ENV variable $attr to true,"; }.
+ qq{ echo "You must set the ENV variable $attr to 'true',"; }.
' echo "to avoid getting resource forks in your dist."; exit 255; fi' });
}
}
use Moose::Meta::Class ();
extends 'Catalyst::Component';
use Moose::Util qw/find_meta/;
-use bytes;
use B::Hooks::EndOfScope ();
use Catalyst::Exception;
use Catalyst::Exception::Detach;
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.80013';
+our $VERSION = '5.80014_01';
{
my $dev_version = $VERSION =~ /_\d{2}$/;
}
else {
# everything should be bytes at this point, but just in case
- $response->content_length( bytes::length( $response->body ) );
+ $response->content_length( length( $response->body ) );
}
}
my $class = ref $proto || $proto;
Class::MOP::load_class( $plugin );
-
+ $class->log->warn( "$plugin inherits from 'Catalyst::Component' - this is decated and will not work in 5.81" )
+ if $plugin->isa( 'Catalyst::Component' );
$proto->_plugins->{$plugin} = 1;
unless ($instant) {
no strict 'refs';
if ( $ENV{SERVER_PORT} == 443 ) {
$request->secure(1);
}
+ binmode(STDOUT); # Ensure we are sending bytes.
}
=head2 $self->prepare_headers($c)
$self->_fix_env( \%env );
+ # hack for perl libraries that use FILENO (e.g. IPC::Run)
+ # trying to patch FCGI.pm, but not got there yet :/
+ local *FCGI::Stream::FILENO = sub { -2 }
+ unless FCGI::Stream->can('FILENO');
+
$class->handle_request( env => \%env );
$proc_manager && $proc_manager->pm_post_dispatch();
package My::Exception;
use Moose;
use namespace::clean -except => 'meta';
-
+
with 'Catalyst::Exception::Basic';
-
+
# Elsewhere..
- My::Exception::Basic->throw( qq/Fatal exception/ );
+ My::Exception->throw( qq/Fatal exception/ );
See also L<Catalyst> and L<Catalyst::Exception>.
=head2 as_string
-Stringifies the exception's message attribute.
+Stringifies the exception's message attribute.
Called when the object is stringified by overloading.
=head2 throw( $message )
Catalyst::Exception::Detach - Exception for redispatching using $ctx->detach()
-=head1 SYNOPSIS
-
- Do not use this class directly, instead you should use the singleton instance
- found in $Catalyst::DETACH;
-
- E.g. die $Catalyst::DETACH
-
-See also L<Catalyst> and L<Catalyst::Exception>.
-
=head1 DESCRIPTION
This is the class for the Catalyst Exception which is thrown then you call
-C<< $c->detach() >>. There should be a singleton instance of this class in the
-C<< $Catalyst::DETACH >> global variable.
+C<< $c->detach() >>.
-Users should never need to know or care about this exception, please just use
-C<< $c->detach >>
+This class is not intended to be used directly by users.
=head2 meta
Provided by Moose
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
Catalyst::Exception::Go - Exception for redispatching using $ctx->go()
-=head1 SYNOPSIS
-
- Do not use this class directly, instead you should use the singleton instance
- found in $Catalyst::GO;
-
- E.g. die $Catalyst::GO;
-
-See also L<Catalyst> and L<Catalyst::Exception>.
-
=head1 DESCRIPTION
This is the class for the Catalyst Exception which is thrown then you call
-C<< $c->go() >>. There should be a singleton instance of this class in the
-C<< $Catalyst::DETACH >> global variable.
+C<< $c->go() >>.
-Users should never need to know or care about this exception, please just use
-C<< $c->detach >>
+This class is not intended to be used directly by users.
=head2 meta
Provided by Moose
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
=head1 NAME
-Catalyst::Exception::Interface - Exception for redispatching using $ctx->detach()
+Catalyst::Exception::Interface - Role defining the interface for Catalyst exceptions
=head1 SYNOPSIS
package My::Catalyst::Like::Exception;
use Moose;
use namespace::clean -except => 'meta';
-
+
+ with 'Catalyst::Exception::Interface';
+
# This comprises the required interface.
sub as_string { 'the exception text for stringification' }
sub die { shift; die @_ }
sub die { shift; die @_ }
-
- with 'Catalyst::Exception::Interface';
-
-See also L<Catalyst> and L<Catalyst::Exception>.
=head1 DESCRIPTION
Provided by Moose
+=head1 SEE ALSO
+
+=over 4
+
+=item L<Catalyst>
+
+=item L<Catalyst::Exception>
+
+=back
+
=head1 AUTHORS
Catalyst Contributors, see Catalyst.pm
# Remember to update this in Catalyst as well!
-our $VERSION='5.80013';
+our $VERSION='5.80014_01';
$VERSION = eval $VERSION;
+++ /dev/null
-use Test::More;
-
-eval "use Test::Pod 1.14";
-plan skip_all => 'Test::Pod 1.14 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
-
-all_pod_files_ok();
+++ /dev/null
-use Test::More;
-
-eval "use Pod::Coverage 0.19";
-plan skip_all => 'Pod::Coverage 0.19 required' if $@;
-eval "use Test::Pod::Coverage 1.04";
-plan skip_all => 'Test::Pod::Coverage 1.04 required' if $@;
-plan skip_all => 'set TEST_POD to enable this test' unless $ENV{TEST_POD} || -e 'inc/.author';
-
-all_pod_coverage_ok(
- {
- also_private => ['BUILD']
- }
-);
+++ /dev/null
-use strict;
-use warnings;
-
-use File::Spec;
-use FindBin ();
-use Test::More;
-
-if ( !-e "$FindBin::Bin/../MANIFEST.SKIP" ) {
- plan skip_all => 'Critic test only for developers.';
-}
-else {
- eval { require Test::NoTabs };
- if ( $@ ) {
- plan tests => 1;
- fail( 'You must install Test::NoTabs to run 04critic.t' );
- exit;
- }
-}
-
-Test::NoTabs->import;
-all_perl_files_ok(qw/lib/);
--- /dev/null
+use strict;
+use warnings;
+use FindBin qw/$Bin/;
+use lib "$Bin/../lib";
+use File::Spec;
+use Test::More;
+
+use Catalyst::Test qw/TestAppEncoding/;
+
+if ( $ENV{CATALYST_SERVER} ) {
+ plan skip_all => 'This test does not run live';
+ exit 0;
+}
+
+my $fn = "$Bin/../catalyst_130pix.gif";
+ok -r $fn, 'Can read catalyst_130pix.gif';
+my $size = -s $fn;
+{
+ my $r = request('/binary');
+ is $r->code, 200, '/binary OK';
+ is $r->header('Content-Length'), $size, '/binary correct content length';
+}
+{
+ my $r = request('/binary_utf8');
+ is $r->code, 200, '/binary_utf8 OK';
+ is $r->header('Content-Length'), $size, '/binary_utf8 correct content length';
+}
+
+done_testing;
+
--- /dev/null
+use strict;
+use warnings;
+
+use File::Spec;
+use FindBin ();
+use Test::More;
+use Test::NoTabs;
+
+all_perl_files_ok(qw/lib/);
+
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+use Test::Pod 1.14;
+
+all_pod_files_ok();
+
--- /dev/null
+use strict;
+use warnings;
+use Test::More;
+
+use Pod::Coverage 0.19;
+use Test::Pod::Coverage 1.04;
+
+all_pod_coverage_ok(
+ {
+ also_private => ['BUILD']
+ }
+);
+
my $warnings;
BEGIN { # Do this at compile time in case we generate a warning when use
# DeprecatedTestApp
- $SIG{__WARN__} = sub { $warnings++ if $_[0] =~ /trying to use NEXT/ };
+ $SIG{__WARN__} = sub {
+ $warnings++ if $_[0] =~ /uses NEXT, which is deprecated/;
+ $warnings++ if $_[0] =~ /trying to use NEXT, which is deprecated/;
+ };
}
use Catalyst; # Cause catalyst to be used so I can fiddle with the logging.
my $mvc_warnings;
use strict;
use warnings;
-use NEXT;
sub prepare {
my $class = shift;
use warnings;
use MRO::Compat;
-use base qw/Catalyst::Controller Class::Data::Inheritable/;
+use base qw/Class::Data::Inheritable/;
__PACKAGE__->mk_classdata('ran_setup');
package TestApp::Controller::Root;
-
+use strict;
+use warnings;
use base 'Catalyst::Controller';
__PACKAGE__->config->{namespace} = '';
--- /dev/null
+package TestAppEncoding;
+use strict;
+use warnings;
+use base qw/Catalyst/;
+use Catalyst;
+
+__PACKAGE__->config(name => __PACKAGE__);
+__PACKAGE__->setup;
+
+1;
+
--- /dev/null
+package TestAppEncoding::Controller::Root;
+use strict;
+use warnings;
+use base 'Catalyst::Controller';
+use Test::More;
+
+__PACKAGE__->config->{namespace} = '';
+
+sub binary : Local {
+ my ($self, $c) = @_;
+ $c->res->body(do { open(my $fh, '<', $c->path_to('..', '..', 'catalyst_130pix.gif')) or die $!; local $/ = undef; <$fh>; });
+}
+
+sub binary_utf8 : Local {
+ my ($self, $c) = @_;
+ $c->forward('binary');
+ my $str = $c->res->body;
+ utf8::upgrade($str);
+ ok utf8::is_utf8($str), 'Body is variable width encoded string';
+ $c->res->body($str);
+}
+
+sub end : Private {
+ my ($self,$c) = @_;
+}
+
+1;
use Test::Exception;
use Catalyst qw/+TestPluginWithConstructor/;
use Moose;
-BEGIN { extends qw/Catalyst Catalyst::Controller/ } # Ewww, FIXME.
+extends qw/Catalyst/;
__PACKAGE__->setup;
our $MODIFIER_FIRED = 0;