blib/lib/CatalystX/RoleApplicator.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 35 / 35 CC 2 SCAR 2.2
CC
2
Cov
100%
init_meta
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package CatalystX::RoleApplicator;
2 1 our $VERSION = '0.005';
3  
4 # ABSTRACT: apply roles to your Catalyst application-related classes
5  
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Moose ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Moose::Util::MetaRole;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Moose::Exporter;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use MooseX::RelatedClassRoles;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 Moose::Exporter->setup_import_methods();
14  
15 1 ▶sub init_meta {
Subroutine init_meta: called CC=2 SCAR=6.9
Pod documented
16 1 my $self = shift;
17 1 my %p = @_;
18 1 my $meta = Moose->init_meta(%p);
19  
20 # leave out context_class because it's set later in Catalyst.pm instead of
21 # up-front, so anyone who doesn't set it will get explosions; also, it's just
22 # MyApp, most of the time, so add your own roles
23 1 for (qw(request response engine dispatcher stats)) {
24 5 Class::MOP::class_of('MooseX::RelatedClassRoles')
25 ->apply($meta, name => $_, require_class_accessor => 0);
26 }
27  
28 1 return $meta;
29 }
30  
31 1 1;
32  
33  
34  
35  
36 =pod
37  
38 =head1 NAME
39  
40 CatalystX::RoleApplicator - apply roles to your Catalyst application-related classes
41  
42 =head1 VERSION
43  
44 version 0.005
45  
46 =head1 SYNOPSIS
47  
48 package MyApp;
49  
50 use base 'Catalyst';
51 use Catalyst;
52 use CatalystX::RoleApplicator;
53  
54 __PACKAGE__->apply_request_class_roles(
55 qw/My::Request::Role Other::Request::Role/
56 );
57  
58 =head1 DESCRIPTION
59  
60 CatalystX::RoleApplicator makes it easy for you to apply roles to all the
61 various classes that your Catalyst application uses.
62  
63 =head1 METHODS
64  
65 =head2 apply_request_class_roles
66  
67 =head2 apply_response_class_roles
68  
69 =head2 apply_engine_class_roles
70  
71 =head2 apply_dispatcher_class_roles
72  
73 =head2 apply_stats_class_roles
74  
75 Apply the named roles to one of the classes your application uses.
76  
77 =head2 init_meta
78  
79 Apply the Moose extensions that power this class.
80  
81 =head1 AUTHOR
82  
83 Hans Dieter Pearcey <hdp@cpan.org>
84  
85 =head1 COPYRIGHT AND LICENSE
86  
87 This software is copyright (c) 2009 by Hans Dieter Pearcey <hdp@cpan.org>.
88  
89 This is free software; you can redistribute it and/or modify it under
90 the same terms as perl itself.
91  
92 =cut
93  
94  
95  
96 __END__
↑ Summary