← 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:55 2010

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/Number.pm
Statements Executed 12
Statement Execution Time 177µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11115µs2.42msMooseX::AttributeHelpers::Number::::BEGIN@2 MooseX::AttributeHelpers::Number::BEGIN@2
1118µs104µsMooseX::AttributeHelpers::Number::::BEGIN@11 MooseX::AttributeHelpers::Number::BEGIN@11
0000s0sMoose::Meta::Attribute::Custom::Number::::register_implementationMoose::Meta::Attribute::Custom::Number::register_implementation
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package MooseX::AttributeHelpers::Number;
2363µs24.83ms
# spent 2.42ms (15µs+2.41) within MooseX::AttributeHelpers::Number::BEGIN@2 which was called # once (15µs+2.41ms) by MooseX::AttributeHelpers::BEGIN@24 at line 2
use Moose;
# spent 2.42ms making 1 call to MooseX::AttributeHelpers::Number::BEGIN@2 # spent 2.41ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389]
3
41600nsour $VERSION = '0.23';
5116µs$VERSION = eval $VERSION;
61300nsour $AUTHORITY = 'cpan:STEVAN';
7
812µs1377µsextends 'Moose::Meta::Attribute';
# spent 377µs making 1 call to Moose::extends
912µs17.01mswith 'MooseX::AttributeHelpers::Trait::Number';
# spent 7.01ms making 1 call to Moose::with
10
11376µs2199µs
# spent 104µs (8+96) within MooseX::AttributeHelpers::Number::BEGIN@11 which was called # once (8µs+96µs) by MooseX::AttributeHelpers::BEGIN@24 at line 11
no Moose;
# spent 104µs making 1 call to MooseX::AttributeHelpers::Number::BEGIN@11 # spent 96µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478]
12
13# register the alias ...
14package # hide me from search.cpan.org
15 Moose::Meta::Attribute::Custom::Number;
16sub register_implementation { 'MooseX::AttributeHelpers::Number' }
17
18118µs1;
19
20=pod
21
22=head1 NAME
23
24MooseX::AttributeHelpers::Number
25
26=head1 SYNOPSIS
27
28 package Real;
29 use Moose;
30 use MooseX::AttributeHelpers;
31
32 has 'integer' => (
33 metaclass => 'Number',
34 is => 'ro',
35 isa => 'Int',
36 default => sub { 5 },
37 provides => {
38 set => 'set',
39 add => 'add',
40 sub => 'sub',
41 mul => 'mul',
42 div => 'div',
43 mod => 'mod',
44 abs => 'abs',
45 }
46 );
47
48 my $real = Real->new();
49 $real->add(5); # same as $real->integer($real->integer + 5);
50 $real->sub(2); # same as $real->integer($real->integer - 2);
51
52=head1 DESCRIPTION
53
54This provides a simple numeric attribute, which supports most of the
55basic math operations.
56
57=head1 METHODS
58
59=over 4
60
61=item B<meta>
62
63=item B<helper_type>
64
65=item B<method_constructors>
66
67=back
68
69=head1 PROVIDED METHODS
70
71It is important to note that all those methods do in place
72modification of the value stored in the attribute.
73
74=over 4
75
76=item I<set ($value)>
77
78Alternate way to set the value.
79
80=item I<add ($value)>
81
82Adds the current value of the attribute to C<$value>.
83
84=item I<sub ($value)>
85
86Subtracts the current value of the attribute to C<$value>.
87
88=item I<mul ($value)>
89
90Multiplies the current value of the attribute to C<$value>.
91
92=item I<div ($value)>
93
94Divides the current value of the attribute to C<$value>.
95
96=item I<mod ($value)>
97
98Modulus the current value of the attribute to C<$value>.
99
100=item I<abs>
101
102Sets the current value of the attribute to its absolute value.
103
104=back
105
106=head1 BUGS
107
108All complex software has bugs lurking in it, and this module is no
109exception. If you find a bug please either email me, or add the bug
110to cpan-RT.
111
112=head1 AUTHOR
113
114Robert Boone
115
116=head1 COPYRIGHT AND LICENSE
117
118Copyright 2007-2009 by Infinity Interactive, Inc.
119
120L<http://www.iinteractive.com>
121
122This library is free software; you can redistribute it and/or modify
123it under the same terms as Perl itself.
124
125=cut