merged conflicts
John Napiorkowski [Fri, 20 Sep 2013 18:19:26 +0000 (14:19 -0400)]
120 files changed:
.gitignore
MANIFEST.SKIP
Makefile.PL
cpanfile [new file with mode: 0644]
lib/Catalyst.pm
lib/Catalyst/Component.pm
lib/Catalyst/Controller.pm
lib/Catalyst/Delta.pod
lib/Catalyst/Dispatcher.pm
lib/Catalyst/Engine/HTTP.pm
lib/Catalyst/Log.pm
lib/Catalyst/Script/Create.pm
lib/Catalyst/Script/Server.pm
lib/Catalyst/ScriptRole.pm
lib/Catalyst/Test.pm
lib/Catalyst/Utils.pm
t/aggregate.t
t/aggregate/c3_appclass_bug.t
t/aggregate/caf_backcompat.t
t/aggregate/custom_live_component_controller_action_auto_doublebug.t
t/aggregate/custom_live_path_bug.t
t/aggregate/error_page_dump.t
t/aggregate/live_component_controller_action_action.t
t/aggregate/live_component_controller_action_auto.t
t/aggregate/live_component_controller_action_begin.t
t/aggregate/live_component_controller_action_chained.t
t/aggregate/live_component_controller_action_default.t
t/aggregate/live_component_controller_action_detach.t
t/aggregate/live_component_controller_action_die_in_end.t
t/aggregate/live_component_controller_action_end.t
t/aggregate/live_component_controller_action_forward.t
t/aggregate/live_component_controller_action_global.t
t/aggregate/live_component_controller_action_go.t
t/aggregate/live_component_controller_action_index.t
t/aggregate/live_component_controller_action_index_or_default.t
t/aggregate/live_component_controller_action_inheritance.t
t/aggregate/live_component_controller_action_local.t
t/aggregate/live_component_controller_action_multipath.t
t/aggregate/live_component_controller_action_path.t
t/aggregate/live_component_controller_action_path_matchsingle.t
t/aggregate/live_component_controller_action_private.t
t/aggregate/live_component_controller_action_streaming.t
t/aggregate/live_component_controller_action_visit.t
t/aggregate/live_component_controller_args.t
t/aggregate/live_component_controller_attributes.t
t/aggregate/live_component_view_single.t
t/aggregate/live_engine_request_auth.t
t/aggregate/live_engine_request_body.t
t/aggregate/live_engine_request_body_demand.t
t/aggregate/live_engine_request_cookies.t
t/aggregate/live_engine_request_env.t
t/aggregate/live_engine_request_escaped_path.t
t/aggregate/live_engine_request_headers.t
t/aggregate/live_engine_request_parameters.t
t/aggregate/live_engine_request_prepare_parameters.t
t/aggregate/live_engine_request_remote_user.t
t/aggregate/live_engine_request_uploads.t
t/aggregate/live_engine_response_body.t
t/aggregate/live_engine_response_cookies.t
t/aggregate/live_engine_response_emptybody.t
t/aggregate/live_engine_response_errors.t
t/aggregate/live_engine_response_headers.t
t/aggregate/live_engine_response_large.t
t/aggregate/live_engine_response_print.t
t/aggregate/live_engine_response_redirect.t
t/aggregate/live_engine_response_status.t
t/aggregate/live_engine_setup_basics.t
t/aggregate/live_engine_setup_plugins.t
t/aggregate/live_loop.t
t/aggregate/live_plugin_loaded.t
t/aggregate/live_priorities.t
t/aggregate/meta_method_unneeded.t
t/aggregate/unit_core_action_for.t
t/aggregate/unit_core_classdata.t
t/aggregate/unit_core_engine_fixenv-iis6.t
t/aggregate/unit_core_engine_fixenv-lighttpd.t
t/aggregate/unit_core_plugin.t
t/aggregate/unit_core_script_cgi.t
t/aggregate/unit_core_script_create.t
t/aggregate/unit_core_script_fastcgi.t
t/aggregate/unit_core_script_help.t
t/aggregate/unit_core_scriptrunner.t
t/aggregate/unit_core_setup_log.t
t/aggregate/unit_core_uri_for_action.t
t/aggregate/unit_load_catalyst_test.t
t/aggregate/unit_metaclass_compat_extend_non_moose_controller.t
t/aggregate/unit_metaclass_compat_non_moose.t
t/aggregate/unit_metaclass_compat_non_moose_controller.t
t/aggregate/unit_utils_prefix.t
t/author/unicode_plugin_nested_params.t
t/custom_exception_class_simple.t
t/dead_load_bad_args.t
t/dead_load_multiple_chained_attributes.t
t/dead_no_unknown_error.t
t/dead_recursive_chained_attributes.t
t/deprecated.t
t/lib/Catalyst/Plugin/Test/MangleDollarUnderScore.pm
t/lib/TestApp.pm
t/lib/TestApp/Controller/Fork.pm
t/lib/TestAppPluginWithConstructor.pm
t/live_fork.t
t/live_stats.t
t/optional_apache-cgi-rewrite.pl
t/optional_apache-cgi.pl
t/optional_apache-fastcgi-non-root.pl
t/optional_apache-fastcgi.pl
t/optional_lighttpd-fastcgi-non-root.t
t/optional_lighttpd-fastcgi.t
t/optional_memleak.t
t/optional_stress.t
t/optional_threads.t
t/plugin_new_method_backcompat.t
t/psgi_file_testapp_engine_plackup_compat.t
t/unicode_plugin_config.t
t/unicode_plugin_live.t
t/unicode_plugin_no_encoding.t
t/unicode_plugin_request_decode.t
t/unit_core_script_test.t
t/unit_stats.t
t/unit_utils_load_class.t

index cf496fb..3fa8dde 100644 (file)
@@ -1,18 +1,17 @@
 .*
 !.gitignore
-Makefile*
+/Makefile*
 !Makefile.PL
-MYMETA.json
-MYMETA.yml
-META.yml
-blib
-build
-inc
-pm_to_blib
-MANIFEST*
+/MYMETA.*
+/META.*
+/blib/
+/build/
+/inc/
+/pm_to_blib
+/MANIFEST*
 !MANIFEST.SKIP
-Debian*
+/Debian*
 #README
-Catalyst-Runtime-*
+/Catalyst-Runtime-*
 *.bs
-t/tmp
+/t/tmp
index 1b7456f..b9ad8e0 100644 (file)
@@ -1 +1,2 @@
 ^(?!script/\w+\.pl$|TODO$|lib/.+(?<!ROADMAP)\.p(m|od)$|inc/|t/a(uthor|ggregate)/.*\.t$|t/([^/]+|.{1,2}|[^t][^m][^p].*)\.(gif|yml|pl|t)$|t/lib/.*\.pm$|t/something/(Makefile.PL|script/foo/bar/for_dist)$|t/conf/extra.conf.in$|Makefile.PL$|README$|MANIFEST$|Changes$|META.yml$|.+testappencodingsetinconfig.json|.+TestMiddleware/share.*)
+/cpanfile
index e561124..79b8380 100644 (file)
@@ -31,10 +31,9 @@ requires 'namespace::autoclean' => '0.09';
 requires 'namespace::clean' => '0.23';
 requires 'MooseX::Emulate::Class::Accessor::Fast' => '0.00903';
 requires 'Class::Load' => '0.12';
-requires 'Class::MOP' => '0.95';
 requires 'Data::OptList';
 requires 'Moose' => '1.03';
-requires 'MooseX::MethodAttributes::Inheritable' => '0.24';
+requires 'MooseX::MethodAttributes::Role::AttrContainer::Inheritable' => '0.24';
 requires 'MooseX::Role::WithOverloading' => '0.09';
 requires 'Carp';
 requires 'Class::C3::Adopt::NEXT' => '0.07';
@@ -56,7 +55,7 @@ requires 'Text::SimpleTable' => '0.03';
 requires 'Time::HiRes';
 requires 'Tree::Simple' => '1.15';
 requires 'Tree::Simple::Visitor::FindByPath';
-requires 'Try::Tiny';
+requires 'Try::Tiny' => '0.17';
 requires 'Safe::Isa';
 requires 'Task::Weaken';
 requires 'Text::Balanced'; # core in 5.8.x but mentioned for completeness
@@ -74,10 +73,10 @@ requires 'URI' => '1.36';
 requires 'JSON::MaybeXS' => '1.000000',
 
 # Install the standalone Regex dispatch modules in order to ease the
-# depreciation transition
+# deprecation transition
 requires 'Catalyst::DispatchType::Regex' => '5.90021';
 
-test_requires 'Test::Exception';
+test_requires 'Test::Fatal';
 test_requires 'Test::More' => '0.88';
 test_requires 'Data::Dump';
 test_requires 'HTTP::Request::Common';
@@ -85,6 +84,9 @@ test_requires 'IO::Scalar';
 test_requires 'HTTP::Status';
 test_requires 'JSON::MaybeXS';
 
+# see also cpanfile for authordeps -- install via
+# cpanm --installdeps --with-develop .
+
 # aggregate tests if AGGREGATE_TESTS is set and a recent Test::Aggregate and a Test::Simple it works with is available
 my @author_requires;
 if ($ENV{AGGREGATE_TESTS} && can_use('Test::Simple', '0.88') && can_use('Test::Aggregate', '0.364')) {
diff --git a/cpanfile b/cpanfile
new file mode 100644 (file)
index 0000000..4e0cb76
--- /dev/null
+++ b/cpanfile
@@ -0,0 +1,22 @@
+# install these with the command:
+# cpanm --installdeps --with-develop .
+on 'develop' => sub {
+    requires 'Test::Simple' => '0.88';
+    requires 'Test::Aggregate' => '0.364';
+    requires 'CatalystX::LeakChecker' => '0.05';
+    requires 'Catalyst::Devel' => '1.0';        # For http server test
+    requires 'Test::WWW::Mechanize::Catalyst' => '0.51';
+    requires 'Test::TCP' => '1.27';             # ditto, ships Net::EmptyPort
+    requires 'File::Copy::Recursive' => 0;
+    requires 'Catalyst::Engine::PSGI' => 0;
+    requires 'Test::Without::Module' => 0;
+    requires 'Starman' => 0;
+    requires 'MooseX::Daemonize' => 0;
+    requires 'Test::NoTabs' => 0;
+    requires 'Test::Pod' => 0;
+    requires 'Test::Pod::Coverage' => 0;
+    requires 'Test::Spelling' => 0;
+    requires 'Pod::Coverage::TrustPod' => 0;
+    requires 'Catalyst::Plugin::Params::Nested' => 0;
+    requires 'Catalyst::Plugin::ConfigLoader' => 0;
+};
index 8fc94d6..0e2fdbd 100644 (file)
@@ -35,13 +35,14 @@ use utf8;
 use Carp qw/croak carp shortmess/;
 use Try::Tiny;
 use Safe::Isa;
+use Moose::Util 'find_meta';
 use Plack::Middleware::Conditional;
 use Plack::Middleware::ReverseProxy;
 use Plack::Middleware::IIS6ScriptNameFix;
 use Plack::Middleware::IIS7KeepAliveFix;
 use Plack::Middleware::LighttpdScriptNameFix;
 use Plack::Util;
-use Class::Load;
+use Class::Load 'load_class';
 
 BEGIN { require 5.008003; }
 
@@ -326,7 +327,18 @@ cookies, HTTP headers, etc.). See L<Catalyst::Request>.
 
 =head2 $c->forward( $class, $method, [, \@arguments ] )
 
-Forwards processing to another action, by its private name. If you give a
+This is one way of calling another action (method) in the same or
+a different controller. You can also use C<< $self->my_method($c, @args) >>
+in the same controller or C<< $c->controller('MyController')->my_method($c, @args) >>
+in a different controller.
+The main difference is that 'forward' uses some of the Catalyst request
+cycle overhead, including debugging, which may be useful to you. On the
+other hand, there are some complications to using 'forward', restrictions
+on values returned from 'forward', and it may not handle errors as you prefer.
+Whether you use 'forward' or not is up to you; it is not considered superior to
+the other ways to call a method.
+
+'forward' calls  another action, by its private name. If you give a
 class name but no method, C<process()> is called. You may also optionally
 pass arguments in an arrayref. The action will receive the arguments in
 C<@_> and C<< $c->req->args >>. Upon returning from the function,
@@ -2488,7 +2500,7 @@ sub run {
 
 sub _make_immutable_if_needed {
     my $class = shift;
-    my $meta = Class::MOP::get_metaclass_by_name($class);
+    my $meta = find_meta($class);
     my $isa_ca = $class->isa('Class::Accessor::Fast') || $class->isa('Class::Accessor');
     if (
         $meta->is_immutable
@@ -2679,7 +2691,7 @@ sub setup_dispatcher {
         $dispatcher = $class->dispatcher_class;
     }
 
-    Class::MOP::load_class($dispatcher);
+    load_class($dispatcher);
 
     # dispatcher instance
     $class->dispatcher( $dispatcher->new );
@@ -2729,7 +2741,7 @@ sub setup_engine {
     # Don't really setup_engine -- see _setup_psgi_app for explanation.
     return if $class->loading_psgi_file;
 
-    Class::MOP::load_class($engine);
+    load_class($engine);
 
     if ($ENV{MOD_PERL}) {
         my $apache = $class->engine_loader->auto;
@@ -3005,7 +3017,7 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
         my ( $proto, $plugin, $instant ) = @_;
         my $class = ref $proto || $proto;
 
-        Class::MOP::load_class( $plugin );
+        load_class( $plugin );
         $class->log->warn( "$plugin inherits from 'Catalyst::Component' - this is deprecated and will not work in 5.81" )
             if $plugin->isa( 'Catalyst::Component' );
         my $plugin_meta = Moose::Meta::Class->create($plugin);
@@ -3053,7 +3065,7 @@ the plugin name does not begin with C<Catalyst::Plugin::>.
          } @{ $plugins };
 
         for my $plugin ( reverse @plugins ) {
-            Class::MOP::load_class($plugin->[0], $plugin->[1]);
+            load_class($plugin->[0], $plugin->[1]);
             my $meta = find_meta($plugin->[0]);
             next if $meta && $meta->isa('Moose::Meta::Role');
 
index f747099..13c9323 100644 (file)
@@ -9,6 +9,8 @@ use Devel::InnerPackage ();
 use MRO::Compat;
 use mro 'c3';
 use Scalar::Util 'blessed';
+use Class::Load 'is_class_loaded';
+use Moose::Util 'find_meta';
 use namespace::clean -except => 'meta';
 
 with 'MooseX::Emulate::Class::Accessor::Fast';
@@ -93,7 +95,7 @@ sub BUILDARGS {
     } elsif (@_ == 2) { # is it ($app, $args) or foo => 'bar' ?
         if (blessed($_[0])) {
             $args = $_[1] if ref($_[1]) eq 'HASH';
-        } elsif (Class::MOP::is_class_loaded($_[0]) &&
+        } elsif (is_class_loaded($_[0]) &&
                 $_[0]->isa('Catalyst') && ref($_[1]) eq 'HASH') {
             $args = $_[1];
         } else {
@@ -137,7 +139,7 @@ sub config {
         # work in a subclass.
         # TODO maybe this should be a ClassData option?
         my $class = blessed($self) || $self;
-        my $meta = Class::MOP::get_metaclass_by_name($class);
+        my $meta = find_meta($class);
         unless (${ $meta->get_or_add_package_symbol('$_config') }) {
             # Call merge_hashes to ensure we deep copy the parent
             # config onto the subclass
index 99c2893..d312441 100644 (file)
@@ -9,7 +9,10 @@ use List::Util qw/first/;
 use List::MoreUtils qw/uniq/;
 use namespace::clean -except => 'meta';
 
-BEGIN { extends qw/Catalyst::Component MooseX::MethodAttributes::Inheritable/; }
+BEGIN {
+    extends qw/Catalyst::Component/;
+    with qw/MooseX::MethodAttributes::Role::AttrContainer::Inheritable/;
+}
 
 use MooseX::MethodAttributes;
 use Catalyst::Exception;
@@ -317,7 +320,7 @@ sub action_class {
         ? $args{attributes}{ActionClass}[0]
         : $self->_action_class);
 
-    Class::MOP::load_class($class);
+    load_class($class);
     return $class;
 }
 
@@ -744,7 +747,7 @@ Handle various types of paths:
     sub myaction2 :Path('/bar') { ... } # -> /bar
   }
 
-This is a general toolbox for attaching your action to a give path.
+This is a general toolbox for attaching your action to a given path.
 
 
 =head2 Regex
index 81cd319..8b5caf2 100755 (executable)
@@ -167,7 +167,7 @@ classes are better implemented as Moose roles.
 
 =item *
 
-L<MooseX::MethodAttributes::Inheritable> is used to contain action
+L<MooseX::MethodAttributes::Role::AttrContainer::Inheritable> is used to contain action
 attributes. This means that attributes are represented in the MOP, and
 decouples action creation from attributes.
 
index d9fe5b3..6fde402 100644 (file)
@@ -14,6 +14,7 @@ use Catalyst::Utils;
 use Text::SimpleTable;
 use Tree::Simple;
 use Tree::Simple::Visitor::FindByPath;
+use Class::Load qw(load_class try_load_class);
 
 use namespace::clean -except => 'meta';
 
@@ -516,7 +517,8 @@ sub register {
         unless ( $registered->{$class} ) {
             # FIXME - Some error checking and re-throwing needed here, as
             #         we eat exceptions loading dispatch types.
-            eval { Class::MOP::load_class($class) };
+            # see also try_load_class
+            eval { load_class($class) };
             my $load_failed = $@;
             $self->_check_deprecated_dispatch_type( $key, $load_failed );
             push( @{ $self->dispatch_types }, $class->new ) unless $load_failed;
@@ -660,9 +662,8 @@ sub _load_dispatch_types {
         # first param is undef because we cannot get the appclass
         my $class = Catalyst::Utils::resolve_namespace(undef, 'Catalyst::DispatchType', $type);
 
-        eval { Class::MOP::load_class($class) };
-        Catalyst::Exception->throw( message => qq/Couldn't load "$class"/ )
-          if $@;
+        my ($success, $error) = try_load_class($class);
+        Catalyst::Exception->throw( message => $error ) if not $success;
         push @{ $self->dispatch_types }, $class->new;
 
         push @loaded, $class;
index 7b506e6..cf43c0d 100644 (file)
@@ -22,7 +22,7 @@ __END__
 
 =head1 NAME
 
-Catalyst::Engine::HTTP
+Catalyst::Engine::HTTP - removed module
 
 =head1 SYNOPSIS
 
index d72ee16..b834a79 100644 (file)
@@ -4,7 +4,7 @@ use Moose;
 with 'MooseX::Emulate::Class::Accessor::Fast';
 
 use Data::Dump;
-use Class::MOP ();
+use Moose::Util 'find_meta';
 use Carp qw/ cluck /;
 
 our %LEVELS = (); # Levels stored as bit field, ergo debug = 1, warn = 2 etc
@@ -33,7 +33,7 @@ sub psgienv {
 {
     my @levels = qw[ debug info warn error fatal ];
 
-    my $meta = Class::MOP::get_metaclass_by_name(__PACKAGE__);
+    my $meta = find_meta(__PACKAGE__);
     my $summed_level = 0;
     for ( my $i = $#levels ; $i >= 0 ; $i-- ) {
 
index 593323d..a74653b 100644 (file)
@@ -1,5 +1,6 @@
 package Catalyst::Script::Create;
 use Moose;
+use Class::Load 'load_class';
 use namespace::autoclean;
 
 with 'Catalyst::ScriptRole';
@@ -42,7 +43,7 @@ sub run {
     $self->print_usage_text if !$self->ARGV->[0];
 
     my $helper_class = $self->helper_class;
-    Class::MOP::load_class($helper_class);
+    load_class($helper_class);
     my $helper = $helper_class->new( { '.newfiles' => !$self->force, mech => $self->mechanize } );
 
     $self->print_usage_text unless $helper->mk_component( $self->application_name, @{$self->extra_argv} );
index 270490e..1848e4a 100644 (file)
@@ -1,7 +1,7 @@
 package Catalyst::Script::Server;
 use Moose;
 use Catalyst::Utils;
-use Try::Tiny;
+use Class::Load qw(try_load_class load_class);
 use namespace::autoclean;
 
 with 'Catalyst::ScriptRole';
@@ -49,11 +49,9 @@ subtype 'Catalyst::Script::Server::Types::Pidfile',
     as 'MooseX::Daemonize::Pid::File';
 
 coerce 'Catalyst::Script::Server::Types::Pidfile', from 'Str', via {
-    try { Class::MOP::load_class("MooseX::Daemonize::Pid::File") }
-    catch {
-        warn("Could not load MooseX::Daemonize::Pid::File, needed for --pid option\n");
-        exit 1;
-    };
+    my ($success, $error) = try_load_class("MooseX::Daemonize::Pid::File");
+    warn("Could not load MooseX::Daemonize::Pid::File, needed for --pid option: $error\n"),
+        exit 1 if not $success;
     MooseX::Daemonize::Pid::File->new( file => $_ );
 };
 MooseX::Getopt::OptionTypeMap->add_option_type_to_map(
@@ -76,11 +74,11 @@ sub BUILD {
 
     if ($self->background) {
         # FIXME - This is evil. Should we just add MX::Daemonize to the deps?
-        try { Class::MOP::load_class('MooseX::Daemonize::Core'); Class::MOP::load_class('POSIX') }
-        catch {
-            warn("MooseX::Daemonize is needed for the --background option\n");
-            exit 1;
-        };
+        my ($success, $error) = try_load_class("MooseX::Daemonize::Core");
+        warn("MooseX::Daemonize is needed for the --background option: $error\n"),
+            exit 1 if not $success;
+        my ($success, $error) = try_load_class("POSIX");
+        warn("$error\n"), exit 1 if not $success;
         MooseX::Daemonize::Core->meta->apply($self);
         POSIX::close($_) foreach (0..2);
     }
@@ -229,7 +227,7 @@ sub run {
 
             return 1 unless $self->is_daemon;
 
-            Class::MOP::load_class($self->application_name);
+            load_class($self->application_name);
 
             $self->daemon_detach;
         }
index 4bab785..f8a12da 100644 (file)
@@ -5,6 +5,7 @@ use MooseX::Getopt;
 use Catalyst::EngineLoader;
 use Moose::Util::TypeConstraints;
 use Catalyst::Utils qw/ ensure_class_loaded /;
+use Class::Load 'load_class';
 use namespace::autoclean;
 
 subtype 'Catalyst::ScriptRole::LoadableClass',
@@ -87,7 +88,7 @@ sub _plack_engine_name {}
 sub _run_application {
     my $self = shift;
     my $app = $self->application_name;
-    Class::MOP::load_class($app);
+    load_class($app);
     my $server;
     if (my $e = $self->_plack_engine_name ) {
         $server = $self->load_engine($e, $self->_plack_loader_args);
index 53c16a2..e121b35 100644 (file)
@@ -7,8 +7,9 @@ use Test::More ();
 use Plack::Test;
 use Catalyst::Exception;
 use Catalyst::Utils;
-use Class::MOP;
+use Class::Load qw(load_class is_class_loaded);
 use Sub::Exporter;
+use Moose::Util 'find_meta';
 use Carp 'croak', 'carp';
 
 sub _build_request_export {
@@ -25,7 +26,7 @@ sub _build_request_export {
     return sub { croak "Must specify a test app: use Catalyst::Test 'TestApp'" }
         unless $class;
 
-    Class::MOP::load_class($class) unless Class::MOP::is_class_loaded($class);
+    load_class($class) unless is_class_loaded($class);
     $class->import;
 
     return sub { _local_request( $class, @_ ) };
@@ -58,7 +59,7 @@ sub _build_ctx_request_export {
 
         # hook into 'dispatch' -- the function gets called after all plugins
         # have done their work, and it's an easy place to capture $c.
-        my $meta = Class::MOP::get_metaclass_by_name($class);
+        my $meta = find_meta($class);
         $meta->make_mutable;
         $meta->add_after_method_modifier( "dispatch", sub {
             $ctx_closed_over = shift;
index e6a8801..31773b7 100644 (file)
@@ -7,7 +7,7 @@ use Path::Class;
 use URI;
 use Carp qw/croak/;
 use Cwd;
-use Class::MOP;
+use Class::Load 'is_class_loaded';
 use String::RewritePrefix;
 use Class::Load ();
 
@@ -137,9 +137,8 @@ sub class2tempdir {
 
     if ( $create && !-e $tmpdir ) {
 
-        eval { $tmpdir->mkpath };
-
-        if ($@) {
+        eval { $tmpdir->mkpath; 1 }
+        or do {
             # don't load Catalyst::Exception as a BEGIN in Utils,
             # because Utils often gets loaded before MyApp.pm, and if
             # Catalyst::Exception is loaded before MyApp.pm, it does
@@ -298,7 +297,7 @@ sub ensure_class_loaded {
     # if it already has symbol table entries. This is to support things like Schema::Loader, which
     # part-generate classes in memory, but then also load some of their contents from disk.
     return if !$opts->{ ignore_loaded }
-        && Class::MOP::is_class_loaded($class); # if a symbol entry exists we don't load again
+        && is_class_loaded($class); # if a symbol entry exists we don't load again
 
     # this hack is so we don't overwrite $@ if the load did not generate an error
     my $error;
@@ -313,7 +312,7 @@ sub ensure_class_loaded {
     die $error if $error;
 
     warn "require $class was successful but the package is not defined."
-        unless Class::MOP::is_class_loaded($class);
+        unless is_class_loaded($class);
 
     return 1;
 }
@@ -392,17 +391,17 @@ my $_term_width;
 sub term_width {
     return $_term_width if $_term_width;
 
-    my $width = eval '
-        use Term::Size::Any;
+    my $width;
+    eval '
+        require Term::Size::Any;
         my ($columns, $rows) = Term::Size::Any::chars;
-        return $columns;
-    ';
-
-    if ($@) {
+        $width = $columns;
+        1;
+    ' or do {
         $width = $ENV{COLUMNS}
             if exists($ENV{COLUMNS})
             && $ENV{COLUMNS} =~ m/^\d+$/;
-    }
+    };
 
     $width = 80 unless ($width && $width >= 80);
     return $_term_width = $width;
index 543fe02..e071379 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index 0e5f7ed..e7b44a4 100644 (file)
@@ -21,10 +21,10 @@ use Test::More tests => 1;
     /;
 }
 
-use Test::Exception;
-lives_ok {
+use Test::Fatal;
+is exception {
     TestAppC3ErrorUseMoose->setup();
-} 'No C3 error';
+}, undef, 'No C3 error';
 
 1;
 
index 27d8fa9..ddff5f6 100644 (file)
@@ -1,8 +1,7 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
-use Class::MOP ();
+use Class::Load 'load_class';
 use Moose::Util ();
 
 # List of everything which used Class::Accessor::Fast in 5.70.
@@ -22,7 +21,7 @@ my @modules = qw/
 plan tests => scalar @modules;
 
 foreach my $module (@modules) {
-    Class::MOP::load_class($module);
+    load_class($module);
     ok Moose::Util::does_role($module => 'MooseX::Emulate::Class::Accessor::Fast'),
         "$module has Class::Accessor::Fast back-compat";
 }
index 099f8da..6cec423 100644 (file)
@@ -1,15 +1,15 @@
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Engine;
 
 my $m = sub { Catalyst::Engine->_dump_error_page_element(@_) };
 
-lives_ok { $m->('Scalar' => ['foo' => 'bar']) };
-lives_ok { $m->('Array' => ['foo' => []]) };
-lives_ok { $m->('Hash' => ['foo' => {}]) }; 
+is exception { $m->('Scalar' => ['foo' => 'bar']) }, undef;
+is exception { $m->('Array' => ['foo' => []]) }, undef;
+is exception { $m->('Hash' => ['foo' => {}]) }, undef;
 
 done_testing;
 
index f5370ce..77b6e7c 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 # This tests to make sure the Authorization header is passed through by the engine.
 
 use strict;
index 1a6c0d8..e6c8747 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 # This tests to make sure the REMOTE_USER environment variable is properly passed through by the engine.
 
 use strict;
index e7b59f9..6b80879 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index 64161aa..106f6bc 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index bd28d25..e415827 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index f52a9b4..5678e94 100644 (file)
@@ -3,7 +3,6 @@ use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 use Test::More tests => 1;
-use Test::Exception;
 use Carp ();
 
 # Doing various silly things, like for example
index d054dc6..2661fc4 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 use Scalar::Util qw/refaddr blessed/;
index becc3c1..847195e 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
index 697f2ad..7c4ca00 100644 (file)
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
 use strict;
 use warnings;
 
@@ -6,14 +5,14 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::CGI;
 
 local @ARGV;
-lives_ok {
+is exception {
     Catalyst::Script::CGI->new_with_options(application_name => 'TestAppToTestScripts')->run;
-} "new_with_options";
+}, undef, "new_with_options";
 shift @TestAppToTestScripts::RUN_ARGS;
 my $server = pop @TestAppToTestScripts::RUN_ARGS;
 like ref($server), qr/^Plack::Handler/, 'Is a Plack::Handler';
index d492fd9..a27dc25 100644 (file)
@@ -1,8 +1,7 @@
-#!/usr/bin/env perl
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
@@ -41,9 +40,9 @@ use lib "$Bin/../lib";
 {
     local $TestCreateScript::help;
     local @ARGV;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run;
-    } "no argv";
+    }, undef, "no argv";
     ok $TestCreateScript::help, 'Exited with usage info';
 }
 {
@@ -51,9 +50,9 @@ use lib "$Bin/../lib";
     local @ARGV = 'foo';
     local @TestHelperClass::ARGS;
     local %TestHelperClass::p;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass')->run;
-    } "with argv";
+    }, undef, "with argv";
     ok !$TestCreateScript::help, 'Did not exit with usage into';
     is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct';
     is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct';
@@ -64,9 +63,9 @@ use lib "$Bin/../lib";
     local @ARGV = 'foo';
     local @TestHelperClass::ARGS;
     local %TestHelperClass::p;
-    lives_ok {
+    is exception {
         TestCreateScript->new_with_options(application_name => 'TestAppToTestScripts', helper_class => 'TestHelperClass::False')->run;
-    } "with argv";
+    }, undef, "with argv";
     ok $TestCreateScript::help, 'Did exit with usage into as mk_component returned false';
     is_deeply \@TestHelperClass::ARGS, ['TestAppToTestScripts', 'foo'], 'Args correct';
     is_deeply \%TestHelperClass::p, { '.newfiles' => 1, mech => undef }, 'Params correct';
index 93f1c16..80a8068 100644 (file)
@@ -5,7 +5,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::FastCGI;
 
@@ -32,9 +32,9 @@ sub testOption {
 
     local @ARGV = @$argstring;
     local @TestAppToTestScripts::RUN_ARGS;
-    lives_ok {
+    is exception {
         TestFastCGIScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
-    } "new_with_options";
+    }, undef, "new_with_options";
     # First element of RUN_ARGS will be the script name, which we don't care about
     shift @TestAppToTestScripts::RUN_ARGS;
 
index 00d24da..e2fc4a2 100644 (file)
@@ -1,8 +1,7 @@
-#!/usr/bin/env perl
 use strict;
 use warnings;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
@@ -21,9 +20,9 @@ test('-?');
 sub test {
     local $TestHelpScript::help;
     local @ARGV = (@_);
-    lives_ok {
+    is exception {
         TestHelpScript->new_with_options(application_name => 'TestAppToTestScripts')->run;
-    } 'Lives';
+    }, undef, 'Lives';
     ok $TestHelpScript::help, 'Got help';
 }
 
index 763ddec..5e44ebe 100644 (file)
@@ -2,7 +2,7 @@ use strict;
 use warnings;
 use Test::More;
 use FindBin qw/$Bin/;
-use Test::Exception;
+use Test::Fatal;
 use lib "$Bin/../lib";
 
 use_ok('Catalyst::ScriptRunner');
@@ -15,8 +15,8 @@ is Catalyst::ScriptRunner->run('ScriptTestApp', 'Baz'), 'mooCatalyst::Script::Ba
     'Script existing only in Catalyst';
 # +1 test for the params passed to new_with_options in t/lib/Catalyst/Script/Baz.pm
 
-throws_ok(sub {
+like exception {
     Catalyst::ScriptRunner->run('ScriptTestApp', 'CompileTest');
-}, qr/Couldn't load class/);
+}, qr/Couldn't load class/;
 
 done_testing;
index e2dba17..fb73297 100644 (file)
@@ -2,7 +2,6 @@ use strict;
 use warnings;
 
 use Test::More tests => 30;
-use Test::Exception;
 
 use Catalyst ();
 
index 68dfbdf..a39498b 100644 (file)
@@ -8,7 +8,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/../lib";
 use Catalyst::Utils;
 use HTTP::Request::Common;
-use Test::Exception;
+use Test::Fatal;
 
 my $Class   = 'Catalyst::Test';
 my $App     = 'TestApp';
@@ -88,7 +88,7 @@ use Catalyst::Test ();
         ok( $c->stash,          "               Stash accessible" );
         ok( $c->action,         "               Action object accessible" );
         ok( $res->request,      "               Response has request object" );
-        lives_and { is( $res->request->uri, $Url) }
+        is exception { is( $res->request->uri, $Url) }, undef,
                                 "               Request object has correct url";
     } }
 }
@@ -146,12 +146,12 @@ sub customize { Catalyst::Test::_customize_request($_[0], {}, @_[1 .. $#_]) }
 use_ok('Catalyst::Test', 'TestApp', 'foobar');
 
 # Back compat test, ensure that request ignores anything which isn't a hash.
-lives_ok {
+is exception {
     request(GET('/dummy'), 'foo');
-} 'scalar additional param to request method ignored';
-lives_ok {
+}, undef, 'scalar additional param to request method ignored';
+is exception {
     request(GET('/dummy'), []);
-} 'array additional param to request method ignored';
+}, undef, 'array additional param to request method ignored';
 
 my $res = request(GET('/'));
 is $res->code, 200, 'Response code 200';
index 568a629..07a7daa 100644 (file)
@@ -12,9 +12,9 @@ use Catalyst ();
     package TestApp::Controller::Other;
     use Moose;
     use Test::More tests => 1;
-    use Test::Exception;
-    lives_ok {
+    use Test::Fatal;
+    is exception {
         extends 'TestApp::Controller::Base';
-    };
+    }, undef;
 }
 
index 1672a18..8036be4 100644 (file)
@@ -5,7 +5,7 @@ use FindBin;
 use lib "$FindBin::Bin/../lib";
 
 use Test::More tests => 1;
-use Test::Exception;
+use Test::Fatal;
 use TestAppNonMooseController;
 
 # Metaclass init order causes fail.
@@ -13,7 +13,7 @@ use TestAppNonMooseController;
 # f2391d17574eff81d911b97be15ea51080500003
 # after which the evil kludge in core can die in a fire.
 
-lives_ok {
+is exception {
     TestAppNonMooseController::ControllerBase->get_action_methods
-} 'Base class->get_action_methods ok when sub class initialized first';
+}, undef, 'Base class->get_action_methods ok when sub class initialized first';
 
index 506fbc2..0351955 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
index 11e884e..f9f47c6 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use Test::More;
index 24983fa..27e4516 100644 (file)
@@ -1,20 +1,18 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 use Test::More tests => 2;
-use Test::Exception;
+use Test::Fatal;
 
-lives_ok {
+is exception {
     require TestAppClassExceptionSimpleTest;
-} 'Can load application';
+}, undef, 'Can load application';
 
 
-lives_ok {
+is exception {
     Catalyst::Exception->throw
-} 'throw is properly stubbed out';
+}, undef, 'throw is properly stubbed out';
 
 
 
index d80195f..98b566c 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 use lib 't/lib';
index 47b635f..fd9f6b8 100755 (executable)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use FindBin qw/$Bin/;
index 77b9bcd..c2971de 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 use lib 't/lib';
index 307181b..9e5579e 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 use FindBin qw/$Bin/;
index 94a5184..32c304d 100644 (file)
@@ -2,11 +2,12 @@ package Catalyst::Plugin::Test::MangleDollarUnderScore;
 use strict;
 use warnings;
 
+# FIXME - should proably use utf8??
 our $VERSION = 0.1; # Make is_class_loaded happy
 
-# Class::MOP::load_class($_) can hurt you real hard.
+# Class::Load::load_class($_) can hurt you real hard.
 BEGIN { $_ = q{
-mst sayeth, Class::MOP::load_class($_) will ruin your life
+mst sayeth, Class::Load::load_class($_) will ruin your life
 rafl spokeh "i â™¥ my $_"',
 and verrily forsooth, t0m made tests
 and yea, there was fail' }; }
index b06880c..bb88a73 100644 (file)
@@ -11,6 +11,7 @@ use Catalyst qw/
     +TestApp::Role
 /;
 use Catalyst::Utils;
+use Class::Load 'try_load_class';
 
 use Moose;
 use namespace::autoclean;
@@ -59,7 +60,7 @@ TestApp->config(
 # above ->setup so we have some generated methods to be double sure.
 has an_attribute_before_we_change_base_classes => ( is => 'ro');
 
-if ($::setup_leakchecker && eval { Class::MOP::load_class('CatalystX::LeakChecker'); 1 }) {
+if ($::setup_leakchecker && try_load_class('CatalystX::LeakChecker')) {
     with 'CatalystX::LeakChecker';
 
     has leaks => (
index 086d149..2a91193 100644 (file)
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 # Fork.pm 
 # Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
 
index 3d0d552..faa1f9c 100644 (file)
@@ -1,7 +1,7 @@
 # See t/plugin_new_method_backcompat.t
 package TestAppPluginWithConstructor;
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Catalyst qw/+TestPluginWithConstructor/;
 use Moose;
 extends qw/Catalyst/;
@@ -9,9 +9,9 @@ extends qw/Catalyst/;
 __PACKAGE__->setup;
 our $MODIFIER_FIRED = 0;
 
-lives_ok {
+is exception {
     before 'dispatch' => sub { $MODIFIER_FIRED = 1 }
-} 'Can apply method modifier';
+}, undef, 'Can apply method modifier';
 no Moose;
 
 our $IS_IMMUTABLE_YET = __PACKAGE__->meta->is_immutable;
index 9c053e3..3a2dc3c 100644 (file)
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
 # live_fork.t
 # Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
 
index a8c9c13..d47b50b 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index 8ce1d6b..abf467e 100755 (executable)
@@ -1,5 +1,3 @@
-#!perl
-
 # Run all tests against CGI mode under Apache
 #
 # Note, to get this to run properly, you may need to give it the path to your
index fd2d9a6..f81c7c4 100755 (executable)
@@ -1,5 +1,3 @@
-#!perl
-
 # Run all tests against CGI mode under Apache
 #
 # Note, to get this to run properly, you may need to give it the path to your
index 23ea42d..bc1b2a5 100755 (executable)
@@ -1,5 +1,3 @@
-#!perl
-
 # Run all tests against FastCGI mode under Apache
 #
 # Note, to get this to run properly, you may need to give it the path to your
index 715a623..95c3702 100755 (executable)
@@ -1,5 +1,3 @@
-#!perl
-
 # Run all tests against FastCGI mode under Apache
 #
 # Note, to get this to run properly, you may need to give it the path to your
index 98567f7..07a5828 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index ba193a3..ca4cbcf 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index c4ccee2..9e73cc5 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index 9ed878f..c45e66e 100644 (file)
@@ -1,5 +1,3 @@
-#!perl
-
 use strict;
 use warnings;
 
index 07de6d9..28455fb 100644 (file)
@@ -9,7 +9,6 @@
 
 # Also tests method modifiers and etc in MyApp.pm still work as expected.
 use Test::More;
-use Test::Exception;
 use Moose::Util qw/find_meta/;
 use FindBin;
 use lib "$FindBin::Bin/lib";
index 3578c6c..4f5a2ea 100644 (file)
@@ -4,7 +4,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 use Plack::Test;
 use TestApp;
 use HTTP::Request::Common;
@@ -23,7 +23,7 @@ like $warning, qr/You are running Catalyst\:\:Engine\:\:PSGI/,
 
 test_psgi $app, sub {
     my $cb = shift;
-    lives_ok {
+    is exception {
         my $TIMEOUT_IN_SECONDS = 5;
         local $SIG{ALRM} = sub { die "alarm\n" };
         alarm($TIMEOUT_IN_SECONDS);
@@ -34,7 +34,7 @@ test_psgi $app, sub {
 
         alarm(0);
         1
-    } q{app didn't die or timeout};
+    }, undef, q{app didn't die or timeout};
 };
 
 done_testing;
index 513c978..37c5c6b 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use Test::More;
index de810aa..87d9061 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use Test::More;
index 8034c38..7b562f8 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use Test::More;
index a3bab97..c3b7171 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/env perl
-
 use strict;
 use warnings;
 use Test::More tests => 5 * 5;
index 1328bde..61db9c0 100644 (file)
@@ -6,7 +6,7 @@ use FindBin qw/$Bin/;
 use lib "$Bin/lib";
 
 use Test::More;
-use Test::Exception;
+use Test::Fatal;
 
 use Catalyst::Script::Test;
 use File::Temp qw/tempfile/;
@@ -28,9 +28,9 @@ sub run_test {
     {
         local @ARGV = ($url);
         my $i;
-        lives_ok {
+        is exception {
             $i = Catalyst::Script::Test->new_with_options(application_name => 'TestApp');
-        } "new_with_options";
+        }, undef, "new_with_options";
         ok $i;
         my $saved;
         open( $saved, '>&'. STDOUT->fileno )
index 676f354..09778c9 100644 (file)
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
index 881b1ff..47994c5 100644 (file)
@@ -1,10 +1,8 @@
-#!/usr/bin/perl
-
 use strict;
 use warnings;
 
 use Test::More tests => 18;
-use Class::MOP;
+use Class::Load 'is_class_loaded';
 
 use lib "t/lib";
 
@@ -21,11 +19,11 @@ $SIG{__WARN__} = sub {
     $warnings++;
 };
 
-ok( !Class::MOP::is_class_loaded("TestApp::View::Dump"), "component not yet loaded" );
+ok( !is_class_loaded("TestApp::View::Dump"), "component not yet loaded" );
 
 Catalyst::Utils::ensure_class_loaded("TestApp::View::Dump");
 
-ok( Class::MOP::is_class_loaded("TestApp::View::Dump"), "loaded ok" );
+ok( is_class_loaded("TestApp::View::Dump"), "loaded ok" );
 is( $warnings, 0, "no warnings emitted" );
 
 $warnings = 0;
@@ -33,10 +31,10 @@ $warnings = 0;
 Catalyst::Utils::ensure_class_loaded("TestApp::View::Dump");
 is( $warnings, 0, "calling again doesn't reaload" );
 
-ok( !Class::MOP::is_class_loaded("TestApp::View::Dump::Request"), "component not yet loaded" );
+ok( !is_class_loaded("TestApp::View::Dump::Request"), "component not yet loaded" );
 
 Catalyst::Utils::ensure_class_loaded("TestApp::View::Dump::Request");
-ok( Class::MOP::is_class_loaded("TestApp::View::Dump::Request"), "loaded ok" );
+ok( is_class_loaded("TestApp::View::Dump::Request"), "loaded ok" );
 
 is( $warnings, 0, "calling again doesn't reaload" );