| File | /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/Trait/Collection/Bag.pm |
| Statements Executed | 23 |
| Statement Execution Time | 408µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 303µs | 5.27ms | MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@10 |
| 1 | 1 | 1 | 14µs | 1.49ms | MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@3 |
| 1 | 1 | 1 | 9µs | 1.19ms | MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@4 |
| 1 | 1 | 1 | 8µs | 102µs | MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@37 |
| 1 | 1 | 1 | 8µs | 113µs | MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@36 |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::Trait::Collection::Bag::__ANON__[:33] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::Trait::Collection::Bag::__ANON__[:34] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::Trait::Collection::Bag::helper_type |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package MooseX::AttributeHelpers::Trait::Collection::Bag; | ||||
| 3 | 3 | 27µs | 2 | 2.96ms | # spent 1.49ms (14µs+1.47) within MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@3 which was called
# once (14µs+1.47ms) by MooseX::AttributeHelpers::BEGIN@21 at line 3 # spent 1.49ms making 1 call to MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@3
# spent 1.47ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389] |
| 4 | 3 | 54µs | 2 | 2.37ms | # spent 1.19ms (9µs+1.18) within MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@4 which was called
# once (9µs+1.18ms) by MooseX::AttributeHelpers::BEGIN@21 at line 4 # spent 1.19ms making 1 call to MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@4
# spent 1.18ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389] |
| 5 | |||||
| 6 | 1 | 700ns | our $VERSION = '0.23'; | ||
| 7 | 1 | 14µs | $VERSION = eval $VERSION; | ||
| 8 | 1 | 300ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 9 | |||||
| 10 | 3 | 216µs | 1 | 5.27ms | # spent 5.27ms (303µs+4.97) within MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@10 which was called
# once (303µs+4.97ms) by MooseX::AttributeHelpers::BEGIN@21 at line 10 # spent 5.27ms making 1 call to MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@10 |
| 11 | |||||
| 12 | 1 | 3µs | 1 | 2.04ms | with 'MooseX::AttributeHelpers::Trait::Collection'; # spent 2.04ms making 1 call to Moose::Role::with |
| 13 | |||||
| 14 | 1 | 2µs | 1 | 92µs | has 'method_provider' => ( # spent 92µs making 1 call to Moose::Role::has |
| 15 | is => 'ro', | ||||
| 16 | isa => 'ClassName', | ||||
| 17 | predicate => 'has_method_provider', | ||||
| 18 | default => 'MooseX::AttributeHelpers::MethodProvider::Bag' | ||||
| 19 | ); | ||||
| 20 | |||||
| 21 | 1 | 5µs | 2 | 1.78ms | subtype 'Bag' => as 'HashRef[Int]'; # spent 1.78ms making 1 call to Moose::Util::TypeConstraints::subtype
# spent 3µs making 1 call to Moose::Util::TypeConstraints::as |
| 22 | |||||
| 23 | sub helper_type { 'Bag' } | ||||
| 24 | |||||
| 25 | before 'process_options_for_provides' => sub { | ||||
| 26 | my ($self, $options, $name) = @_; | ||||
| 27 | |||||
| 28 | # Set some default attribute options here unless already defined | ||||
| 29 | if ((my $type = $self->helper_type) && !exists $options->{isa}){ | ||||
| 30 | $options->{isa} = $type; | ||||
| 31 | } | ||||
| 32 | |||||
| 33 | $options->{default} = sub { +{} } unless exists $options->{default}; | ||||
| 34 | 1 | 3µs | 1 | 48µs | }; # spent 48µs making 1 call to Moose::Role::before |
| 35 | |||||
| 36 | 3 | 25µs | 2 | 219µs | # spent 113µs (8+106) within MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@36 which was called
# once (8µs+106µs) by MooseX::AttributeHelpers::BEGIN@21 at line 36 # spent 113µs making 1 call to MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@36
# spent 106µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478] |
| 37 | 3 | 34µs | 2 | 197µs | # spent 102µs (8+95) within MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@37 which was called
# once (8µs+95µs) by MooseX::AttributeHelpers::BEGIN@21 at line 37 # spent 102µs making 1 call to MooseX::AttributeHelpers::Trait::Collection::Bag::BEGIN@37
# spent 95µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478] |
| 38 | |||||
| 39 | 1 | 24µs | 1; | ||
| 40 | |||||
| 41 | __END__ | ||||
| 42 | |||||
| 43 | =pod | ||||
| 44 | |||||
| 45 | =head1 NAME | ||||
| 46 | |||||
| 47 | MooseX::AttributeHelpers::Collection::Bag | ||||
| 48 | |||||
| 49 | =head1 SYNOPSIS | ||||
| 50 | |||||
| 51 | package Stuff; | ||||
| 52 | use Moose; | ||||
| 53 | use MooseX::AttributeHelpers; | ||||
| 54 | |||||
| 55 | has 'word_histogram' => ( | ||||
| 56 | metaclass => 'Collection::Bag', | ||||
| 57 | is => 'ro', | ||||
| 58 | isa => 'Bag', # optional ... as is defalt | ||||
| 59 | provides => { | ||||
| 60 | 'add' => 'add_word', | ||||
| 61 | 'get' => 'get_count_for', | ||||
| 62 | 'empty' => 'has_any_words', | ||||
| 63 | 'count' => 'num_words', | ||||
| 64 | 'delete' => 'delete_word', | ||||
| 65 | } | ||||
| 66 | ); | ||||
| 67 | |||||
| 68 | =head1 DESCRIPTION | ||||
| 69 | |||||
| 70 | This module provides a Bag attribute which provides a number of | ||||
| 71 | bag-like operations. See L<MooseX::AttributeHelpers::MethodProvider::Bag> | ||||
| 72 | for more details. | ||||
| 73 | |||||
| 74 | =head1 METHODS | ||||
| 75 | |||||
| 76 | =over 4 | ||||
| 77 | |||||
| 78 | =item B<meta> | ||||
| 79 | |||||
| 80 | =item B<method_provider> | ||||
| 81 | |||||
| 82 | =item B<has_method_provider> | ||||
| 83 | |||||
| 84 | =item B<helper_type> | ||||
| 85 | |||||
| 86 | =item B<process_options_for_provides> | ||||
| 87 | |||||
| 88 | =back | ||||
| 89 | |||||
| 90 | =head1 BUGS | ||||
| 91 | |||||
| 92 | All complex software has bugs lurking in it, and this module is no | ||||
| 93 | exception. If you find a bug please either email me, or add the bug | ||||
| 94 | to cpan-RT. | ||||
| 95 | |||||
| 96 | =head1 AUTHOR | ||||
| 97 | |||||
| 98 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | ||||
| 99 | |||||
| 100 | =head1 COPYRIGHT AND LICENSE | ||||
| 101 | |||||
| 102 | Copyright 2007-2009 by Infinity Interactive, Inc. | ||||
| 103 | |||||
| 104 | L<http://www.iinteractive.com> | ||||
| 105 | |||||
| 106 | This library is free software; you can redistribute it and/or modify | ||||
| 107 | it under the same terms as Perl itself. | ||||
| 108 | |||||
| 109 | =cut |