← Index
NYTProf Performance Profile   « block view • line view • sub view »
For 05.Domain_and_Item.t
  Run on Tue May 4 17:21:41 2010
Reported on Tue May 4 17:22:38 2010

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers.pm
Statements Executed 67
Statement Execution Time 2.83ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111633µs5.11msMooseX::AttributeHelpers::::BEGIN@15MooseX::AttributeHelpers::BEGIN@15
111436µs7.04msMooseX::AttributeHelpers::::BEGIN@14MooseX::AttributeHelpers::BEGIN@14
111399µs12.5msMooseX::AttributeHelpers::::BEGIN@21MooseX::AttributeHelpers::BEGIN@21
111380µs6.40msMooseX::AttributeHelpers::::BEGIN@16MooseX::AttributeHelpers::BEGIN@16
111352µs12.7msMooseX::AttributeHelpers::::BEGIN@30MooseX::AttributeHelpers::BEGIN@30
111308µs14.5msMooseX::AttributeHelpers::::BEGIN@13MooseX::AttributeHelpers::BEGIN@13
111293µs11.9msMooseX::AttributeHelpers::::BEGIN@31MooseX::AttributeHelpers::BEGIN@31
111292µs11.3msMooseX::AttributeHelpers::::BEGIN@28MooseX::AttributeHelpers::BEGIN@28
111277µs11.5msMooseX::AttributeHelpers::::BEGIN@18MooseX::AttributeHelpers::BEGIN@18
111276µs10.2msMooseX::AttributeHelpers::::BEGIN@24MooseX::AttributeHelpers::BEGIN@24
111275µs11.0msMooseX::AttributeHelpers::::BEGIN@27MooseX::AttributeHelpers::BEGIN@27
111274µs11.5msMooseX::AttributeHelpers::::BEGIN@29MooseX::AttributeHelpers::BEGIN@29
111268µs4.03msMooseX::AttributeHelpers::::BEGIN@20MooseX::AttributeHelpers::BEGIN@20
111260µs13.5msMooseX::AttributeHelpers::::BEGIN@23MooseX::AttributeHelpers::BEGIN@23
111250µs11.0msMooseX::AttributeHelpers::::BEGIN@25MooseX::AttributeHelpers::BEGIN@25
111248µs11.2msMooseX::AttributeHelpers::::BEGIN@26MooseX::AttributeHelpers::BEGIN@26
111247µs12.0msMooseX::AttributeHelpers::::BEGIN@19MooseX::AttributeHelpers::BEGIN@19
111245µs9.92msMooseX::AttributeHelpers::::BEGIN@17MooseX::AttributeHelpers::BEGIN@17
111191µs2.72msMooseX::AttributeHelpers::::BEGIN@10MooseX::AttributeHelpers::BEGIN@10
111177µs2.47msMooseX::AttributeHelpers::::BEGIN@11MooseX::AttributeHelpers::BEGIN@11
11119µs40µsMooseX::AttributeHelpers::::BEGIN@8MooseX::AttributeHelpers::BEGIN@8
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1
2package MooseX::AttributeHelpers;
3
41900nsour $VERSION = '0.23';
5115µs$VERSION = eval $VERSION;
61400nsour $AUTHORITY = 'cpan:STEVAN';
7
8353µs260µs
# spent 40µs (19+21) within MooseX::AttributeHelpers::BEGIN@8 which was called # once (19µs+21µs) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 8
use Moose 0.56 ();
# spent 40µs making 1 call to MooseX::AttributeHelpers::BEGIN@8 # spent 21µs making 1 call to UNIVERSAL::VERSION
9
103127µs12.72ms
# spent 2.72ms (191µs+2.53) within MooseX::AttributeHelpers::BEGIN@10 which was called # once (191µs+2.53ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 10
use MooseX::AttributeHelpers::Meta::Method::Provided;
# spent 2.72ms making 1 call to MooseX::AttributeHelpers::BEGIN@10
113114µs12.47ms
# spent 2.47ms (177µs+2.29) within MooseX::AttributeHelpers::BEGIN@11 which was called # once (177µs+2.29ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 11
use MooseX::AttributeHelpers::Meta::Method::Curried;
# spent 2.47ms making 1 call to MooseX::AttributeHelpers::BEGIN@11
12
133116µs114.5ms
# spent 14.5ms (308µs+14.2) within MooseX::AttributeHelpers::BEGIN@13 which was called # once (308µs+14.2ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 13
use MooseX::AttributeHelpers::Trait::Bool;
# spent 14.5ms making 1 call to MooseX::AttributeHelpers::BEGIN@13
143143µs17.04ms
# spent 7.04ms (436µs+6.60) within MooseX::AttributeHelpers::BEGIN@14 which was called # once (436µs+6.60ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 14
use MooseX::AttributeHelpers::Trait::Counter;
# spent 7.04ms making 1 call to MooseX::AttributeHelpers::BEGIN@14
153160µs15.11ms
# spent 5.11ms (633µs+4.47) within MooseX::AttributeHelpers::BEGIN@15 which was called # once (633µs+4.47ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 15
use MooseX::AttributeHelpers::Trait::Number;
# spent 5.11ms making 1 call to MooseX::AttributeHelpers::BEGIN@15
163111µs16.40ms
# spent 6.40ms (380µs+6.02) within MooseX::AttributeHelpers::BEGIN@16 which was called # once (380µs+6.02ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 16
use MooseX::AttributeHelpers::Trait::String;
# spent 6.40ms making 1 call to MooseX::AttributeHelpers::BEGIN@16
173113µs19.92ms
# spent 9.92ms (245µs+9.68) within MooseX::AttributeHelpers::BEGIN@17 which was called # once (245µs+9.68ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 17
use MooseX::AttributeHelpers::Trait::Collection::List;
# spent 9.92ms making 1 call to MooseX::AttributeHelpers::BEGIN@17
183121µs111.5ms
# spent 11.5ms (277µs+11.2) within MooseX::AttributeHelpers::BEGIN@18 which was called # once (277µs+11.2ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 18
use MooseX::AttributeHelpers::Trait::Collection::Array;
# spent 11.5ms making 1 call to MooseX::AttributeHelpers::BEGIN@18
193112µs112.0ms
# spent 12.0ms (247µs+11.7) within MooseX::AttributeHelpers::BEGIN@19 which was called # once (247µs+11.7ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 19
use MooseX::AttributeHelpers::Trait::Collection::Hash;
# spent 12.0ms making 1 call to MooseX::AttributeHelpers::BEGIN@19
203125µs14.03ms
# spent 4.03ms (268µs+3.76) within MooseX::AttributeHelpers::BEGIN@20 which was called # once (268µs+3.76ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 20
use MooseX::AttributeHelpers::Trait::Collection::ImmutableHash;
# spent 4.03ms making 1 call to MooseX::AttributeHelpers::BEGIN@20
213125µs112.5ms
# spent 12.5ms (399µs+12.1) within MooseX::AttributeHelpers::BEGIN@21 which was called # once (399µs+12.1ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 21
use MooseX::AttributeHelpers::Trait::Collection::Bag;
# spent 12.5ms making 1 call to MooseX::AttributeHelpers::BEGIN@21
22
233131µs113.5ms
# spent 13.5ms (260µs+13.2) within MooseX::AttributeHelpers::BEGIN@23 which was called # once (260µs+13.2ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 23
use MooseX::AttributeHelpers::Counter;
# spent 13.5ms making 1 call to MooseX::AttributeHelpers::BEGIN@23
243140µs110.2ms
# spent 10.2ms (276µs+9.92) within MooseX::AttributeHelpers::BEGIN@24 which was called # once (276µs+9.92ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 24
use MooseX::AttributeHelpers::Number;
# spent 10.2ms making 1 call to MooseX::AttributeHelpers::BEGIN@24
253136µs111.0ms
# spent 11.0ms (250µs+10.8) within MooseX::AttributeHelpers::BEGIN@25 which was called # once (250µs+10.8ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 25
use MooseX::AttributeHelpers::String;
# spent 11.0ms making 1 call to MooseX::AttributeHelpers::BEGIN@25
263131µs111.2ms
# spent 11.2ms (248µs+11.0) within MooseX::AttributeHelpers::BEGIN@26 which was called # once (248µs+11.0ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 26
use MooseX::AttributeHelpers::Bool;
# spent 11.2ms making 1 call to MooseX::AttributeHelpers::BEGIN@26
273139µs111.0ms
# spent 11.0ms (275µs+10.7) within MooseX::AttributeHelpers::BEGIN@27 which was called # once (275µs+10.7ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 27
use MooseX::AttributeHelpers::Collection::List;
# spent 11.0ms making 1 call to MooseX::AttributeHelpers::BEGIN@27
283170µs111.3ms
# spent 11.3ms (292µs+11.0) within MooseX::AttributeHelpers::BEGIN@28 which was called # once (292µs+11.0ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 28
use MooseX::AttributeHelpers::Collection::Array;
# spent 11.3ms making 1 call to MooseX::AttributeHelpers::BEGIN@28
293151µs111.5ms
# spent 11.5ms (274µs+11.2) within MooseX::AttributeHelpers::BEGIN@29 which was called # once (274µs+11.2ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 29
use MooseX::AttributeHelpers::Collection::Hash;
# spent 11.5ms making 1 call to MooseX::AttributeHelpers::BEGIN@29
303188µs112.7ms
# spent 12.7ms (352µs+12.3) within MooseX::AttributeHelpers::BEGIN@30 which was called # once (352µs+12.3ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 30
use MooseX::AttributeHelpers::Collection::ImmutableHash;
# spent 12.7ms making 1 call to MooseX::AttributeHelpers::BEGIN@30
313198µs111.9ms
# spent 11.9ms (293µs+11.6) within MooseX::AttributeHelpers::BEGIN@31 which was called # once (293µs+11.6ms) by MooseX::ClassAttribute::Role::Meta::Class::BEGIN@6 at line 31
use MooseX::AttributeHelpers::Collection::Bag;
# spent 11.9ms making 1 call to MooseX::AttributeHelpers::BEGIN@31
32
3315µs1;
34
35__END__
36
37=pod
38
39=head1 NAME
40
41MooseX::AttributeHelpers - Extend your attribute interfaces (deprecated)
42
43=head1 SYNOPSIS
44
45 package MyClass;
46 use Moose;
47 use MooseX::AttributeHelpers;
48
49 has 'mapping' => (
50 metaclass => 'Collection::Hash',
51 is => 'rw',
52 isa => 'HashRef[Str]',
53 default => sub { {} },
54 provides => {
55 exists => 'exists_in_mapping',
56 keys => 'ids_in_mapping',
57 get => 'get_mapping',
58 set => 'set_mapping',
59 },
60 curries => {
61 set => { set_quantity => [ 'quantity' ] }
62 }
63 );
64
65
66 # ...
67
68 my $obj = MyClass->new;
69 $obj->set_quantity(10); # quantity => 10
70 $obj->set_mapping(4, 'foo'); # 4 => 'foo'
71 $obj->set_mapping(5, 'bar'); # 5 => 'bar'
72 $obj->set_mapping(6, 'baz'); # 6 => 'baz'
73
74
75 # prints 'bar'
76 print $obj->get_mapping(5) if $obj->exists_in_mapping(5);
77
78 # prints '4, 5, 6'
79 print join ', ', $obj->ids_in_mapping;
80
81=head1 DESCRIPTION
82
83B<This distribution is deprecated. The features it provides have been added to
84the Moose core code as L<Moose::Meta::Attribute::Native>. This distribution
85should not be used by any new code.>
86
87While L<Moose> attributes provide you with a way to name your accessors,
88readers, writers, clearers and predicates, this library provides commonly
89used attribute helper methods for more specific types of data.
90
91As seen in the L</SYNOPSIS>, you specify the extension via the
92C<metaclass> parameter. Available meta classes are:
93
94=head1 PARAMETERS
95
96=head2 provides
97
98This points to a hashref that uses C<provider> for the keys and
99C<method> for the values. The method will be added to
100the object itself and do what you want.
101
102=head2 curries
103
104This points to a hashref that uses C<provider> for the keys and
105has two choices for the value:
106
107You can supply C<< {method => [ @args ]} >> for the values. The method will be
108added to the object itself (always using C<@args> as the beginning arguments).
109
110Another approach to curry a method provider is to supply a coderef instead of an
111arrayref. The code ref takes C<$self>, C<$body>, and any additional arguments
112passed to the final method.
113
114 # ...
115
116 curries => {
117 grep => {
118 times_with_day => sub {
119 my ($self, $body, $datetime) = @_;
120 $body->($self, sub { $_->ymd eq $datetime->ymd });
121 }
122 }
123 }
124
125 # ...
126
127 $obj->times_with_day(DateTime->now); # takes datetime argument, checks day
128
129
130=head1 METHOD PROVIDERS
131
132=over
133
134=item L<Number|MooseX::AttributeHelpers::Number>
135
136Common numerical operations.
137
138=item L<String|MooseX::AttributeHelpers::String>
139
140Common methods for string operations.
141
142=item L<Counter|MooseX::AttributeHelpers::Counter>
143
144Methods for incrementing and decrementing a counter attribute.
145
146=item L<Bool|MooseX::AttributeHelpers::Bool>
147
148Common methods for boolean values.
149
150=item L<Collection::Hash|MooseX::AttributeHelpers::Collection::Hash>
151
152Common methods for hash references.
153
154=item L<Collection::ImmutableHash|MooseX::AttributeHelpers::Collection::ImmutableHash>
155
156Common methods for inspecting hash references.
157
158=item L<Collection::Array|MooseX::AttributeHelpers::Collection::Array>
159
160Common methods for array references.
161
162=item L<Collection::List|MooseX::AttributeHelpers::Collection::List>
163
164Common list methods for array references.
165
166=back
167
168=head1 CAVEAT
169
170This is an early release of this module. Right now it is in great need
171of documentation and tests in the test suite. However, we have used this
172module to great success at C<$work> where it has been tested very thoroughly
173and deployed into a major production site.
174
175I plan on getting better docs and tests in the next few releases, but until
176then please refer to the few tests we do have and feel free email and/or
177message me on irc.perl.org if you have any questions.
178
179=head1 TODO
180
181We need tests and docs badly.
182
183=head1 BUGS
184
185All complex software has bugs lurking in it, and this module is no
186exception. If you find a bug please either email me, or add the bug
187to cpan-RT.
188
189=head1 AUTHOR
190
191Stevan Little E<lt>stevan@iinteractive.comE<gt>
192
193B<with contributions from:>
194
195Robert (rlb3) Boone
196
197Paul (frodwith) Driver
198
199Shawn (Sartak) Moore
200
201Chris (perigrin) Prather
202
203Robert (phaylon) Sedlacek
204
205Tom (dec) Lanyon
206
207Yuval Kogman
208
209Jason May
210
211Cory (gphat) Watson
212
213Florian (rafl) Ragwitz
214
215Evan Carroll
216
217Jesse (doy) Luehrs
218
219=head1 COPYRIGHT AND LICENSE
220
221Copyright 2007-2009 by Infinity Interactive, Inc.
222
223L<http://www.iinteractive.com>
224
225This library is free software; you can redistribute it and/or modify
226it under the same terms as Perl itself.
227
228=cut