← 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:23:17 2010

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/Trait/Bool.pm
Statements Executed 16
Statement Execution Time 398µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
111958µs4.81msMooseX::AttributeHelpers::Trait::Bool::::BEGIN@2MooseX::AttributeHelpers::Trait::Bool::BEGIN@2
111311µs1.69msMooseX::AttributeHelpers::Trait::Bool::::BEGIN@3MooseX::AttributeHelpers::Trait::Bool::BEGIN@3
1117µs120µsMooseX::AttributeHelpers::Trait::Bool::::BEGIN@35MooseX::AttributeHelpers::Trait::Bool::BEGIN@35
0000s0sMooseX::AttributeHelpers::Trait::Bool::::__ANON__[:33]MooseX::AttributeHelpers::Trait::Bool::__ANON__[:33]
0000s0sMooseX::AttributeHelpers::Trait::Bool::::helper_typeMooseX::AttributeHelpers::Trait::Bool::helper_type
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::Trait::Bool;
2399µs26.46ms
# spent 4.81ms (958µs+3.85) within MooseX::AttributeHelpers::Trait::Bool::BEGIN@2 which was called # once (958µs+3.85ms) by MooseX::AttributeHelpers::BEGIN@13 at line 2
use Moose::Role;
# spent 4.81ms making 1 call to MooseX::AttributeHelpers::Trait::Bool::BEGIN@2 # spent 1.66ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389]
33210µs11.69ms
# spent 1.69ms (311µs+1.38) within MooseX::AttributeHelpers::Trait::Bool::BEGIN@3 which was called # once (311µs+1.38ms) by MooseX::AttributeHelpers::BEGIN@13 at line 3
use MooseX::AttributeHelpers::MethodProvider::Bool;
# spent 1.69ms making 1 call to MooseX::AttributeHelpers::Trait::Bool::BEGIN@3
4
51600nsour $VERSION = '0.23';
6114µs$VERSION = eval $VERSION;
71300nsour $AUTHORITY = 'cpan:STEVAN';
8
913µs17.44mswith 'MooseX::AttributeHelpers::Trait::Base';
# spent 7.44ms making 1 call to Moose::Role::with
10
11sub helper_type { 'Bool' }
12
13# NOTE:
14# we don't use the method provider for this
15# module since many of the names of the provied
16# methods would conflict with keywords
17# - SL
18
1912µs1102µshas 'method_provider' => (
# spent 102µs making 1 call to Moose::Role::has
20 is => 'ro',
21 isa => 'ClassName',
22 predicate => 'has_method_provider',
23 default => 'MooseX::AttributeHelpers::MethodProvider::Bool'
24);
25
26before 'process_options_for_provides' => sub {
27 my ($self, $options, $name) = @_;
28
29 # Set some default attribute options here unless already defined
30 if ((my $type = $self->helper_type) && !exists $options->{isa}){
31 $options->{isa} = $type;
32 }
3314µs133µs};
# spent 33µs making 1 call to Moose::Role::before
34
35341µs2232µs
# spent 120µs (7+112) within MooseX::AttributeHelpers::Trait::Bool::BEGIN@35 which was called # once (7µs+112µs) by MooseX::AttributeHelpers::BEGIN@13 at line 35
no Moose::Role;
# spent 120µs making 1 call to MooseX::AttributeHelpers::Trait::Bool::BEGIN@35 # spent 112µs making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:478]
36
37123µs1;
38
39=pod
40
41=head1 NAME
42
43MooseX::AttributeHelpers::Bool
44
45=head1 SYNOPSIS
46
47 package Room;
48 use Moose;
49 use MooseX::AttributeHelpers;
50
51 has 'is_lit' => (
52 metaclass => 'Bool',
53 is => 'rw',
54 isa => 'Bool',
55 default => sub { 0 },
56 provides => {
57 set => 'illuminate',
58 unset => 'darken',
59 toggle => 'flip_switch',
60 not => 'is_dark'
61 }
62 );
63
64 my $room = Room->new();
65 $room->illuminate; # same as $room->is_lit(1);
66 $room->darken; # same as $room->is_lit(0);
67 $room->flip_switch; # same as $room->is_lit(not $room->is_lit);
68 return $room->is_dark; # same as !$room->is_lit
69
70=head1 DESCRIPTION
71
72This provides a simple boolean attribute, which supports most of the
73basic math operations.
74
75=head1 METHODS
76
77=over 4
78
79=item B<meta>
80
81=item B<helper_type>
82
83=item B<method_constructors>
84
85=item B<has_method_provider>
86
87=item B<method_provider>
88
89=back
90
91=head1 PROVIDED METHODS
92
93It is important to note that all those methods do in place
94modification of the value stored in the attribute.
95
96=over 4
97
98=item I<set>
99
100Sets the value to C<1>.
101
102=item I<unset>
103
104Set the value to C<0>.
105
106=item I<toggle>
107
108Toggle the value. If it's true, set to false, and vice versa.
109
110=item I<not>
111
112Equivalent of 'not C<$value>'.
113
114=back
115
116=head1 BUGS
117
118All complex software has bugs lurking in it, and this module is no
119exception. If you find a bug please either email me, or add the bug
120to cpan-RT.
121
122=head1 AUTHOR
123
124Jason May
125
126=head1 COPYRIGHT AND LICENSE
127
128Copyright 2007-2009 by Infinity Interactive, Inc.
129
130L<http://www.iinteractive.com>
131
132This library is free software; you can redistribute it and/or modify
133it under the same terms as Perl itself.
134
135=cut