| File | /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/MethodProvider/Counter.pm |
| Statements Executed | 7 |
| Statement Execution Time | 304µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 13µs | 1.46ms | MooseX::AttributeHelpers::MethodProvider::Counter::BEGIN@3 |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::__ANON__[:11] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::__ANON__[:16] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::__ANON__[:21] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::__ANON__[:26] |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::dec |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::inc |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::reset |
| 0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::Counter::set |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | |||||
| 2 | package MooseX::AttributeHelpers::MethodProvider::Counter; | ||||
| 3 | 3 | 271µs | 2 | 2.91ms | # spent 1.46ms (13µs+1.45) within MooseX::AttributeHelpers::MethodProvider::Counter::BEGIN@3 which was called
# once (13µs+1.45ms) by MooseX::AttributeHelpers::Trait::Counter::BEGIN@9 at line 3 # spent 1.46ms making 1 call to MooseX::AttributeHelpers::MethodProvider::Counter::BEGIN@3
# spent 1.45ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389] |
| 4 | |||||
| 5 | 1 | 700ns | our $VERSION = '0.23'; | ||
| 6 | 1 | 22µs | $VERSION = eval $VERSION; | ||
| 7 | 1 | 300ns | our $AUTHORITY = 'cpan:STEVAN'; | ||
| 8 | |||||
| 9 | sub reset : method { | ||||
| 10 | my ($attr, $reader, $writer) = @_; | ||||
| 11 | return sub { $writer->($_[0], $attr->default($_[0])) }; | ||||
| 12 | } | ||||
| 13 | |||||
| 14 | sub set : method { | ||||
| 15 | my ($attr, $reader, $writer, $value) = @_; | ||||
| 16 | return sub { $writer->($_[0], $_[1]) }; | ||||
| 17 | } | ||||
| 18 | |||||
| 19 | sub inc { | ||||
| 20 | my ($attr, $reader, $writer) = @_; | ||||
| 21 | return sub { $writer->($_[0], $reader->($_[0]) + (defined($_[1]) ? $_[1] : 1) ) }; | ||||
| 22 | } | ||||
| 23 | |||||
| 24 | sub dec { | ||||
| 25 | my ($attr, $reader, $writer) = @_; | ||||
| 26 | return sub { $writer->($_[0], $reader->($_[0]) - (defined($_[1]) ? $_[1] : 1) ) }; | ||||
| 27 | } | ||||
| 28 | |||||
| 29 | 1 | 10µs | 1; | ||
| 30 | |||||
| 31 | __END__ | ||||
| 32 | |||||
| 33 | =pod | ||||
| 34 | |||||
| 35 | =head1 NAME | ||||
| 36 | |||||
| 37 | MooseX::AttributeHelpers::MethodProvider::Counter | ||||
| 38 | |||||
| 39 | =head1 DESCRIPTION | ||||
| 40 | |||||
| 41 | This is a role which provides the method generators for | ||||
| 42 | L<MooseX::AttributeHelpers::Counter>. | ||||
| 43 | |||||
| 44 | =head1 METHODS | ||||
| 45 | |||||
| 46 | =over 4 | ||||
| 47 | |||||
| 48 | =item B<meta> | ||||
| 49 | |||||
| 50 | =back | ||||
| 51 | |||||
| 52 | =head1 PROVIDED METHODS | ||||
| 53 | |||||
| 54 | =over 4 | ||||
| 55 | |||||
| 56 | =item B<set> | ||||
| 57 | |||||
| 58 | =item B<inc> | ||||
| 59 | |||||
| 60 | =item B<dec> | ||||
| 61 | |||||
| 62 | =item B<reset> | ||||
| 63 | |||||
| 64 | =back | ||||
| 65 | |||||
| 66 | =head1 BUGS | ||||
| 67 | |||||
| 68 | All complex software has bugs lurking in it, and this module is no | ||||
| 69 | exception. If you find a bug please either email me, or add the bug | ||||
| 70 | to cpan-RT. | ||||
| 71 | |||||
| 72 | =head1 AUTHOR | ||||
| 73 | |||||
| 74 | Stevan Little E<lt>stevan@iinteractive.comE<gt> | ||||
| 75 | |||||
| 76 | =head1 COPYRIGHT AND LICENSE | ||||
| 77 | |||||
| 78 | Copyright 2007-2009 by Infinity Interactive, Inc. | ||||
| 79 | |||||
| 80 | L<http://www.iinteractive.com> | ||||
| 81 | |||||
| 82 | This library is free software; you can redistribute it and/or modify | ||||
| 83 | it under the same terms as Perl itself. | ||||
| 84 | |||||
| 85 | =cut |