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

File /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/MethodProvider/String.pm
Statements Executed 7
Statement Execution Time 596µs
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11115µs1.52msMooseX::AttributeHelpers::MethodProvider::String::::BEGIN@3MooseX::AttributeHelpers::MethodProvider::String::BEGIN@3
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:103]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:103]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:12]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:12]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:18]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:18]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:35]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:35]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:40]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:40]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:49]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:49]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:58]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:58]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:67]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:67]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:72]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:72]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:80]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:80]
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::appendMooseX::AttributeHelpers::MethodProvider::String::append
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::chompMooseX::AttributeHelpers::MethodProvider::String::chomp
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::chopMooseX::AttributeHelpers::MethodProvider::String::chop
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::clearMooseX::AttributeHelpers::MethodProvider::String::clear
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::incMooseX::AttributeHelpers::MethodProvider::String::inc
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::lengthMooseX::AttributeHelpers::MethodProvider::String::length
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::matchMooseX::AttributeHelpers::MethodProvider::String::match
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::prependMooseX::AttributeHelpers::MethodProvider::String::prepend
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::replaceMooseX::AttributeHelpers::MethodProvider::String::replace
0000s0sMooseX::AttributeHelpers::MethodProvider::String::::substrMooseX::AttributeHelpers::MethodProvider::String::substr
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::MethodProvider::String;
33571µs23.02ms
# spent 1.52ms (15µs+1.50) within MooseX::AttributeHelpers::MethodProvider::String::BEGIN@3 which was called # once (15µs+1.50ms) by MooseX::AttributeHelpers::Trait::String::BEGIN@9 at line 3
use Moose::Role;
4
51700nsour $VERSION = '0.23';
6115µs$VERSION = eval $VERSION;
71300nsour $AUTHORITY = 'cpan:STEVAN';
8
9sub append : method {
10 my ($attr, $reader, $writer) = @_;
11
12 return sub { $writer->( $_[0], $reader->($_[0]) . $_[1] ) };
13}
14
15sub prepend : method {
16 my ($attr, $reader, $writer) = @_;
17
18 return sub { $writer->( $_[0], $_[1] . $reader->($_[0]) ) };
19}
20
21sub replace : method {
22 my ($attr, $reader, $writer) = @_;
23
24 return sub {
25 my ( $self, $regex, $replacement ) = @_;
26 my $v = $reader->($_[0]);
27
28 if ( (ref($replacement)||'') eq 'CODE' ) {
29 $v =~ s/$regex/$replacement->()/e;
30 } else {
31 $v =~ s/$regex/$replacement/;
32 }
33
34 $writer->( $_[0], $v);
35 };
36}
37
38sub match : method {
39 my ($attr, $reader, $writer) = @_;
40 return sub { $reader->($_[0]) =~ $_[1] };
41}
42
43sub chop : method {
44 my ($attr, $reader, $writer) = @_;
45 return sub {
46 my $v = $reader->($_[0]);
47 CORE::chop($v);
48 $writer->( $_[0], $v);
49 };
50}
51
52sub chomp : method {
53 my ($attr, $reader, $writer) = @_;
54 return sub {
55 my $v = $reader->($_[0]);
56 chomp($v);
57 $writer->( $_[0], $v);
58 };
59}
60
61sub inc : method {
62 my ($attr, $reader, $writer) = @_;
63 return sub {
64 my $v = $reader->($_[0]);
65 $v++;
66 $writer->( $_[0], $v);
67 };
68}
69
70sub clear : method {
71 my ($attr, $reader, $writer) = @_;
72 return sub { $writer->( $_[0], '' ) }
73}
74
75sub length : method {
76 my ($attr, $reader, $writer) = @_;
77 return sub {
78 my $v = $reader->($_[0]);
79 return CORE::length($v);
80 };
81}
82
83sub substr : method {
84 my ($attr, $reader, $writer) = @_;
85 return sub {
86 my $self = shift;
87 my $v = $reader->($self);
88
89 my $offset = defined $_[0] ? shift : 0;
90 my $length = defined $_[0] ? shift : CORE::length($v);
91 my $replacement = defined $_[0] ? shift : undef;
92
93 my $ret;
94 if (defined $replacement) {
95 $ret = CORE::substr($v, $offset, $length, $replacement);
96 $writer->($self, $v);
97 }
98 else {
99 $ret = CORE::substr($v, $offset, $length);
100 }
101
102 return $ret;
103 };
104}
105
106110µs1;
107
108__END__
109
110=pod
111
112=head1 NAME
113
114MooseX::AttributeHelpers::MethodProvider::String
115
116=head1 DESCRIPTION
117
118This is a role which provides the method generators for
119L<MooseX::AttributeHelpers::String>.
120
121=head1 METHODS
122
123=over 4
124
125=item B<meta>
126
127=back
128
129=head1 PROVIDED METHODS
130
131=over 4
132
133=item B<append>
134
135=item B<prepend>
136
137=item B<replace>
138
139=item B<match>
140
141=item B<chomp>
142
143=item B<chop>
144
145=item B<inc>
146
147=item B<clear>
148
149=item B<length>
150
151=item B<substr>
152
153=back
154
155=head1 BUGS
156
157All complex software has bugs lurking in it, and this module is no
158exception. If you find a bug please either email me, or add the bug
159to cpan-RT.
160
161=head1 AUTHOR
162
163Stevan Little E<lt>stevan@iinteractive.comE<gt>
164
165=head1 COPYRIGHT AND LICENSE
166
167Copyright 2007-2009 by Infinity Interactive, Inc.
168
169L<http://www.iinteractive.com>
170
171This library is free software; you can redistribute it and/or modify
172it under the same terms as Perl itself.
173
174=cut