| File | /usr/local/lib/perl5/site_perl/5.10.1/darwin-2level/Moose/Meta/Role/Application.pm |
| Statements Executed | 15 |
| Statement Execution Time | 588µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 15µs | 18µs | Moose::Meta::Role::Application::BEGIN@3 |
| 1 | 1 | 1 | 8µs | 17µs | Moose::Meta::Role::Application::BEGIN@4 |
| 1 | 1 | 1 | 7µs | 116µs | Moose::Meta::Role::Application::BEGIN@5 |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::__ANON__[:14] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::__ANON__[:20] |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_after_method_modifiers |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_around_method_modifiers |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_attributes |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_before_method_modifiers |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_method_modifiers |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_methods |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::apply_override_method_modifiers |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::check_required_attributes |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::check_required_methods |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::check_role_exclusions |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::is_aliased_method |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::is_method_aliased |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::is_method_excluded |
| 0 | 0 | 0 | 0s | 0s | Moose::Meta::Role::Application::new |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Moose::Meta::Role::Application; | ||||
| 2 | |||||
| 3 | 3 | 23µs | 2 | 22µs | # spent 18µs (15+3) within Moose::Meta::Role::Application::BEGIN@3 which was called
# once (15µs+3µs) by Moose::BEGIN@28 at line 3 # spent 18µs making 1 call to Moose::Meta::Role::Application::BEGIN@3
# spent 3µs making 1 call to strict::import |
| 4 | 3 | 21µs | 2 | 27µs | # spent 17µs (8+10) within Moose::Meta::Role::Application::BEGIN@4 which was called
# once (8µs+10µs) by Moose::BEGIN@28 at line 4 # spent 17µs making 1 call to Moose::Meta::Role::Application::BEGIN@4
# spent 10µs making 1 call to warnings::import |
| 5 | 3 | 502µs | 2 | 225µs | # spent 116µs (7+109) within Moose::Meta::Role::Application::BEGIN@5 which was called
# once (7µs+109µs) by Moose::BEGIN@28 at line 5 # spent 116µs making 1 call to Moose::Meta::Role::Application::BEGIN@5
# spent 109µs making 1 call to metaclass::import |
| 6 | |||||
| 7 | 1 | 600ns | our $VERSION = '0.98'; | ||
| 8 | 1 | 13µs | $VERSION = eval $VERSION; | ||
| 9 | 1 | 300ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 10 | |||||
| 11 | __PACKAGE__->meta->add_attribute('method_exclusions' => ( | ||||
| 12 | init_arg => '-excludes', | ||||
| 13 | reader => 'get_method_exclusions', | ||||
| 14 | default => sub { [] } | ||||
| 15 | 1 | 7µs | 2 | 284µs | )); # spent 268µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 17µs making 1 call to Moose::Meta::Role::Application::meta |
| 16 | |||||
| 17 | __PACKAGE__->meta->add_attribute('method_aliases' => ( | ||||
| 18 | init_arg => '-alias', | ||||
| 19 | reader => 'get_method_aliases', | ||||
| 20 | default => sub { {} } | ||||
| 21 | 1 | 3µs | 2 | 275µs | )); # spent 264µs making 1 call to Class::MOP::Mixin::HasAttributes::add_attribute
# spent 11µs making 1 call to Moose::Meta::Role::Application::meta |
| 22 | |||||
| 23 | sub new { | ||||
| 24 | my ($class, %params) = @_; | ||||
| 25 | |||||
| 26 | if ( exists $params{excludes} && !exists $params{'-excludes'} ) { | ||||
| 27 | $params{'-excludes'} = delete $params{excludes}; | ||||
| 28 | } | ||||
| 29 | if ( exists $params{alias} && !exists $params{'-alias'} ) { | ||||
| 30 | $params{'-alias'} = delete $params{alias}; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | if ( exists $params{'-excludes'} ) { | ||||
| 34 | |||||
| 35 | # I wish we had coercion here :) | ||||
| 36 | $params{'-excludes'} = ( | ||||
| 37 | ref $params{'-excludes'} eq 'ARRAY' | ||||
| 38 | ? $params{'-excludes'} | ||||
| 39 | : [ $params{'-excludes'} ] | ||||
| 40 | ); | ||||
| 41 | } | ||||
| 42 | |||||
| 43 | $class->_new(\%params); | ||||
| 44 | } | ||||
| 45 | |||||
| 46 | sub is_method_excluded { | ||||
| 47 | my ($self, $method_name) = @_; | ||||
| 48 | foreach (@{$self->get_method_exclusions}) { | ||||
| 49 | return 1 if $_ eq $method_name; | ||||
| 50 | } | ||||
| 51 | return 0; | ||||
| 52 | } | ||||
| 53 | |||||
| 54 | sub is_method_aliased { | ||||
| 55 | my ($self, $method_name) = @_; | ||||
| 56 | exists $self->get_method_aliases->{$method_name} ? 1 : 0 | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | sub is_aliased_method { | ||||
| 60 | my ($self, $method_name) = @_; | ||||
| 61 | my %aliased_names = reverse %{$self->get_method_aliases}; | ||||
| 62 | exists $aliased_names{$method_name} ? 1 : 0; | ||||
| 63 | } | ||||
| 64 | |||||
| 65 | sub apply { | ||||
| 66 | my $self = shift; | ||||
| 67 | |||||
| 68 | $self->check_role_exclusions(@_); | ||||
| 69 | $self->check_required_methods(@_); | ||||
| 70 | $self->check_required_attributes(@_); | ||||
| 71 | |||||
| 72 | $self->apply_attributes(@_); | ||||
| 73 | $self->apply_methods(@_); | ||||
| 74 | |||||
| 75 | $self->apply_override_method_modifiers(@_); | ||||
| 76 | |||||
| 77 | $self->apply_before_method_modifiers(@_); | ||||
| 78 | $self->apply_around_method_modifiers(@_); | ||||
| 79 | $self->apply_after_method_modifiers(@_); | ||||
| 80 | } | ||||
| 81 | |||||
| 82 | sub check_role_exclusions { Carp::croak "Abstract Method" } | ||||
| 83 | sub check_required_methods { Carp::croak "Abstract Method" } | ||||
| 84 | sub check_required_attributes { Carp::croak "Abstract Method" } | ||||
| 85 | |||||
| 86 | sub apply_attributes { Carp::croak "Abstract Method" } | ||||
| 87 | sub apply_methods { Carp::croak "Abstract Method" } | ||||
| 88 | sub apply_override_method_modifiers { Carp::croak "Abstract Method" } | ||||
| 89 | sub apply_method_modifiers { Carp::croak "Abstract Method" } | ||||
| 90 | |||||
| 91 | sub apply_before_method_modifiers { (shift)->apply_method_modifiers('before' => @_) } | ||||
| 92 | sub apply_around_method_modifiers { (shift)->apply_method_modifiers('around' => @_) } | ||||
| 93 | sub apply_after_method_modifiers { (shift)->apply_method_modifiers('after' => @_) } | ||||
| 94 | |||||
| 95 | 1 | 18µs | 1; | ||
| 96 | |||||
| 97 | __END__ | ||||
| 98 | |||||
| 99 | =pod | ||||
| 100 | |||||
| 101 | =head1 NAME | ||||
| 102 | |||||
| 103 | Moose::Meta::Role::Application - A base class for role application | ||||
| 104 | |||||
| 105 | =head1 DESCRIPTION | ||||
| 106 | |||||
| 107 | This is the abstract base class for role applications. | ||||
| 108 | |||||
| 109 | The API for this class and its subclasses still needs some | ||||
| 110 | consideration, and is intentionally not yet documented. | ||||
| 111 | |||||
| 112 | =head2 METHODS | ||||
| 113 | |||||
| 114 | =over 4 | ||||
| 115 | |||||
| 116 | =item B<new> | ||||
| 117 | |||||
| 118 | =item B<meta> | ||||
| 119 | |||||
| 120 | =item B<get_method_exclusions> | ||||
| 121 | |||||
| 122 | =item B<is_method_excluded> | ||||
| 123 | |||||
| 124 | =item B<get_method_aliases> | ||||
| 125 | |||||
| 126 | =item B<is_aliased_method> | ||||
| 127 | |||||
| 128 | =item B<is_method_aliased> | ||||
| 129 | |||||
| 130 | =item B<apply> | ||||
| 131 | |||||
| 132 | =item B<check_role_exclusions> | ||||
| 133 | |||||
| 134 | =item B<check_required_methods> | ||||
| 135 | |||||
| 136 | =item B<check_required_attributes> | ||||
| 137 | |||||
| 138 | =item B<apply_attributes> | ||||
| 139 | |||||
| 140 | =item B<apply_methods> | ||||
| 141 | |||||
| 142 | =item B<apply_method_modifiers> | ||||
| 143 | |||||
| 144 | =item B<apply_before_method_modifiers> | ||||
| 145 | |||||
| 146 | =item B<apply_after_method_modifiers> | ||||
| 147 | |||||
| 148 | =item B<apply_around_method_modifiers> | ||||
| 149 | |||||
| 150 | =item B<apply_override_method_modifiers> | ||||
| 151 | |||||
| 152 | =back | ||||
| 153 | |||||
| 154 | =head1 BUGS | ||||
| 155 | |||||
| 156 | See L<Moose/BUGS> for details on reporting bugs. | ||||
| 157 | |||||
| 158 | =head1 AUTHOR | ||||
| 159 | |||||
| 160 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | ||||
| 161 | |||||
| 162 | =head1 COPYRIGHT AND LICENSE | ||||
| 163 | |||||
| 164 | Copyright 2006-2010 by Infinity Interactive, Inc. | ||||
| 165 | |||||
| 166 | L<http://www.iinteractive.com> | ||||
| 167 | |||||
| 168 | This library is free software; you can redistribute it and/or modify | ||||
| 169 | it under the same terms as Perl itself. | ||||
| 170 | |||||
| 171 | =cut | ||||
| 172 |