Profile of /usr/local/lib/perl5/site_perl/5.10.1/MooseX/AttributeHelpers/MethodProvider/String.pm

← 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
--- | --- | --- | --- | --- | ---
1 | 1 | 1 | 15µs | 1.52ms | MooseX::AttributeHelpers::MethodProvider::String::::BEGIN@3MooseX::AttributeHelpers::MethodProvider::String::BEGIN@3
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:103]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:103]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:12]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:12]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:18]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:18]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:35]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:35]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:40]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:40]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:49]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:49]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:58]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:58]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:67]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:67]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:72]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:72]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::__ANON__[:80]MooseX::AttributeHelpers::MethodProvider::String::__ANON__[:80]
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::appendMooseX::AttributeHelpers::MethodProvider::String::append
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::chompMooseX::AttributeHelpers::MethodProvider::String::chomp
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::chopMooseX::AttributeHelpers::MethodProvider::String::chop
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::clearMooseX::AttributeHelpers::MethodProvider::String::clear
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::incMooseX::AttributeHelpers::MethodProvider::String::inc
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::lengthMooseX::AttributeHelpers::MethodProvider::String::length
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::matchMooseX::AttributeHelpers::MethodProvider::String::match
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::prependMooseX::AttributeHelpers::MethodProvider::String::prepend
0 | 0 | 0 | 0s | 0s | MooseX::AttributeHelpers::MethodProvider::String::::replaceMooseX::AttributeHelpers::MethodProvider::String::replace
0 | 0 | 0 | 0s | 0s | MooseX::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 |  |  |  |  |
2 |  |  |  |  | package MooseX::AttributeHelpers::MethodProvider::String;
3 | 3 | 571µs | 2 | 3.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; # spent 1.52ms making 1 call to MooseX::AttributeHelpers::MethodProvider::String::BEGIN@3 # spent 1.50ms making 1 call to Moose::Exporter::__ANON__[Moose/Exporter.pm:389]
4 |  |  |  |  |
5 | 1 | 700ns |  |  | our $VERSION = '0.23';
6 | 1 | 15µs |  |  | $VERSION = eval $VERSION;
7 | 1 | 300ns |  |  | our $AUTHORITY = 'cpan:STEVAN';
8 |  |  |  |  |
9 |  |  |  |  | sub append : method {
10 |  |  |  |  | my ($attr, $reader, $writer) = @_;
11 |  |  |  |  |
12 |  |  |  |  | return sub { $writer->( $_[0], $reader->($_[0]) . $_[1] ) };
13 |  |  |  |  | }
14 |  |  |  |  |
15 |  |  |  |  | sub prepend : method {
16 |  |  |  |  | my ($attr, $reader, $writer) = @_;
17 |  |  |  |  |
18 |  |  |  |  | return sub { $writer->( $_[0], $_[1] . $reader->($_[0]) ) };
19 |  |  |  |  | }
20 |  |  |  |  |
21 |  |  |  |  | sub 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 |  |  |  |  |
38 |  |  |  |  | sub match : method {
39 |  |  |  |  | my ($attr, $reader, $writer) = @_;
40 |  |  |  |  | return sub { $reader->($_[0]) =~ $_[1] };
41 |  |  |  |  | }
42 |  |  |  |  |
43 |  |  |  |  | sub 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 |  |  |  |  |
52 |  |  |  |  | sub 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 |  |  |  |  |
61 |  |  |  |  | sub inc : method {
62 |  |  |  |  | my ($attr, $reader, $writer) = @_;
63 |  |  |  |  | return sub {
64 |  |  |  |  | my $v = $reader->($_[0]);
65 |  |  |  |  | $v++;
66 |  |  |  |  | $writer->( $_[0], $v);
67 |  |  |  |  | };
68 |  |  |  |  | }
69 |  |  |  |  |
70 |  |  |  |  | sub clear : method {
71 |  |  |  |  | my ($attr, $reader, $writer) = @_;
72 |  |  |  |  | return sub { $writer->( $_[0], '' ) }
73 |  |  |  |  | }
74 |  |  |  |  |
75 |  |  |  |  | sub length : method {
76 |  |  |  |  | my ($attr, $reader, $writer) = @_;
77 |  |  |  |  | return sub {
78 |  |  |  |  | my $v = $reader->($_[0]);
79 |  |  |  |  | return CORE::length($v);
80 |  |  |  |  | };
81 |  |  |  |  | }
82 |  |  |  |  |
83 |  |  |  |  | sub 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 |  |  |  |  |
106 | 1 | 10µs |  |  | 1;
107 |  |  |  |  |
108 |  |  |  |  | __END__
109 |  |  |  |  |
110 |  |  |  |  | =pod
111 |  |  |  |  |
112 |  |  |  |  | =head1 NAME
113 |  |  |  |  |
114 |  |  |  |  | MooseX::AttributeHelpers::MethodProvider::String
115 |  |  |  |  |
116 |  |  |  |  | =head1 DESCRIPTION
117 |  |  |  |  |
118 |  |  |  |  | This is a role which provides the method generators for
119 |  |  |  |  | L<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 |  |  |  |  |
157 |  |  |  |  | All complex software has bugs lurking in it, and this module is no
158 |  |  |  |  | exception. If you find a bug please either email me, or add the bug
159 |  |  |  |  | to cpan-RT.
160 |  |  |  |  |
161 |  |  |  |  | =head1 AUTHOR
162 |  |  |  |  |
163 |  |  |  |  | Stevan Little E<lt>stevan@iinteractive.comE<gt>
164 |  |  |  |  |
165 |  |  |  |  | =head1 COPYRIGHT AND LICENSE
166 |  |  |  |  |
167 |  |  |  |  | Copyright 2007-2009 by Infinity Interactive, Inc.
168 |  |  |  |  |
169 |  |  |  |  | L<http://www.iinteractive.com>
170 |  |  |  |  |
171 |  |  |  |  | This library is free software; you can redistribute it and/or modify
172 |  |  |  |  | it under the same terms as Perl itself.
173 |  |  |  |  |
174 |  |  |  |  | =cut