.*
!.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
^(?!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
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';
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
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';
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')) {
--- /dev/null
+# 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;
+};
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; }
=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,
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
$dispatcher = $class->dispatcher_class;
}
- Class::MOP::load_class($dispatcher);
+ load_class($dispatcher);
# dispatcher instance
$class->dispatcher( $dispatcher->new );
# 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;
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);
} @{ $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');
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';
} 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 {
# 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
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;
? $args{attributes}{ActionClass}[0]
: $self->_action_class);
- Class::MOP::load_class($class);
+ load_class($class);
return $class;
}
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
=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.
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';
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;
# 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;
=head1 NAME
-Catalyst::Engine::HTTP
+Catalyst::Engine::HTTP - removed module
=head1 SYNOPSIS
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
{
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-- ) {
package Catalyst::Script::Create;
use Moose;
+use Class::Load 'load_class';
use namespace::autoclean;
with 'Catalyst::ScriptRole';
$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} );
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';
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(
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);
}
return 1 unless $self->is_daemon;
- Class::MOP::load_class($self->application_name);
+ load_class($self->application_name);
$self->daemon_detach;
}
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',
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);
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 {
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, @_ ) };
# 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;
use URI;
use Carp qw/croak/;
use Cwd;
-use Class::MOP;
+use Class::Load 'is_class_loaded';
use String::RewritePrefix;
use Class::Load ();
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
# 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;
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;
}
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;
-#!perl
-
use strict;
use warnings;
/;
}
-use Test::Exception;
-lives_ok {
+use Test::Fatal;
+is exception {
TestAppC3ErrorUseMoose->setup();
-} 'No C3 error';
+}, undef, 'No C3 error';
1;
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.
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";
}
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
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;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
# This tests to make sure the Authorization header is passed through by the engine.
use strict;
-#!perl
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!/usr/bin/evn perl
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
# This tests to make sure the REMOTE_USER environment variable is properly passed through by the engine.
use strict;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
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
-#!perl
-
use strict;
use warnings;
-#!/usr/bin/perl
-
use strict;
use warnings;
use Scalar::Util qw/refaddr blessed/;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!/usr/bin/perl
-
use strict;
use warnings;
-#!/usr/bin/env perl
use strict;
use warnings;
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';
-#!/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";
{
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';
}
{
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';
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';
use lib "$Bin/../lib";
use Test::More;
-use Test::Exception;
+use Test::Fatal;
use Catalyst::Script::FastCGI;
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;
-#!/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";
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';
}
use warnings;
use Test::More;
use FindBin qw/$Bin/;
-use Test::Exception;
+use Test::Fatal;
use lib "$Bin/../lib";
use_ok('Catalyst::ScriptRunner');
'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;
use warnings;
use Test::More tests => 30;
-use Test::Exception;
use Catalyst ();
-#!perl
-
use strict;
use warnings;
use lib "$Bin/../lib";
use Catalyst::Utils;
use HTTP::Request::Common;
-use Test::Exception;
+use Test::Fatal;
my $Class = 'Catalyst::Test';
my $App = 'TestApp';
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";
} }
}
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';
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;
}
-#!/usr/bin/env perl
use strict;
use warnings;
use lib 't/lib';
use lib "$FindBin::Bin/../lib";
use Test::More tests => 1;
-use Test::Exception;
+use Test::Fatal;
use TestAppNonMooseController;
# Metaclass init order causes fail.
# 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';
-#!/usr/bin/perl
-
use strict;
use warnings;
-#!/usr/bin/env perl
-
use strict;
use warnings;
use Test::More;
-#!/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';
-#!perl
-
use strict;
use warnings;
use lib 't/lib';
-#!perl
-
use strict;
use warnings;
use lib 't/lib';
-#!/usr/bin/env perl
-
use strict;
use warnings;
use FindBin qw/$Bin/;
-#!perl
-
use strict;
use warnings;
use lib 't/lib';
-#!/usr/bin/perl
-
use strict;
use warnings;
use FindBin qw/$Bin/;
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' }; }
+TestApp::Role
/;
use Catalyst::Utils;
+use Class::Load 'try_load_class';
use Moose;
use namespace::autoclean;
# 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 => (
-#!/usr/bin/perl
# Fork.pm
# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
# 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/;
__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;
-#!/usr/bin/perl
# live_fork.t
# Copyright (c) 2006 Jonathan Rockway <jrockway@cpan.org>
-#!perl
-
use strict;
use warnings;
-#!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
-#!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
-#!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
-#!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
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
-#!perl
-
use strict;
use warnings;
# 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";
use lib "$Bin/lib";
use Test::More;
-use Test::Exception;
+use Test::Fatal;
use Plack::Test;
use TestApp;
use HTTP::Request::Common;
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);
alarm(0);
1
- } q{app didn't die or timeout};
+ }, undef, q{app didn't die or timeout};
};
done_testing;
-#!/usr/bin/env perl
-
use strict;
use warnings;
use Test::More;
-#!/usr/bin/env perl
-
use strict;
use warnings;
use Test::More;
-#!/usr/bin/env perl
-
use strict;
use warnings;
use Test::More;
-#!/usr/bin/env perl
-
use strict;
use warnings;
use Test::More tests => 5 * 5;
use lib "$Bin/lib";
use Test::More;
-use Test::Exception;
+use Test::Fatal;
use Catalyst::Script::Test;
use File::Temp qw/tempfile/;
{
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 )
-#!/usr/bin/perl
-
use strict;
use warnings;
-#!/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";
$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;
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" );