Catalyst-Runtime
view release on metacpan or search on metacpan
t/configured_comps.t view on Meta::CPAN
use warnings;
use strict;
use HTTP::Request::Common;
use Test::More;
{
package TestRole;
use Moose::Role;
sub role { 'role' }
package Local::Model::Foo;
use Moose;
extends 'Catalyst::Model';
has a => (is=>'ro', required=>1);
has b => (is=>'ro');
sub foo { shift->a . 'foo' }
package Local::Controller::Errors;
use Moose;
use MooseX::MethodAttributes;
extends 'Catalyst::Controller';
has ['a', 'b'] => (is=>'ro', required=>1);
sub not_found :Local { pop->res->from_psgi_response([404, [], ['Not Found']]) }
package MyApp::Model::User;
$INC{'MyApp/Model/User.pm'} = __FILE__;
use Moose;
extends 'Catalyst::Model';
has 'zoo' => (is=>'ro', required=>1, isa=>'Object');
around 'COMPONENT', sub {
my ($orig, $class, $app, $config) = @_;
$config->{zoo} = $app->model('Zoo');
return $class->$orig($app, $config);
};
our %users = (
1 => { name => 'john', age => 46 },
2 => { name => 'mary', age => 36 },
3 => { name => 'ian', age => 25 },
4 => { name => 'visha', age => 18 },
);
sub find {
my ($self, $id) = @_;
my $user = $users{$id} || return;
return bless $user, "MyApp::Model::User::user";
}
package MyApp::Controller::Root;
$INC{'MyApp/Controller/Root.pm'} = __FILE__;
( run in 0.889 second using v1.01-cache-2.11-cpan-39bf76dae61 )