Filename | /home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/Any/Moose.pm |
Statements | Executed 924 statements in 8.41ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
17 | 1 | 1 | 1.89ms | 57.8ms | _install_module | Any::Moose::
17 | 17 | 11 | 714µs | 60.7ms | import | Any::Moose::
19 | 3 | 2 | 477µs | 1.63ms | any_moose | Any::Moose::
17 | 1 | 1 | 415µs | 1.88ms | _canonicalize_options | Any::Moose::
19 | 1 | 1 | 384µs | 521µs | _canonicalize_fragment | Any::Moose::
19 | 1 | 1 | 365µs | 508µs | _backer_of | Any::Moose::
112 | 7 | 1 | 214µs | 214µs | CORE:subst (opcode) | Any::Moose::
12 | 2 | 1 | 48µs | 48µs | _is_moose_loaded | Any::Moose::
30 | 2 | 1 | 46µs | 46µs | CORE:match (opcode) | Any::Moose::
11 | 1 | 1 | 38µs | 38µs | mouse_is_preferred | Any::Moose::
10 | 2 | 2 | 35µs | 35µs | moose_is_preferred | Any::Moose::
1 | 1 | 1 | 27µs | 27µs | BEGIN@7 | Any::Moose::
1 | 1 | 1 | 23µs | 47µs | BEGIN@191 | Any::Moose::
1 | 1 | 1 | 13µs | 27µs | BEGIN@9 | Any::Moose::
1 | 1 | 1 | 12µs | 38µs | BEGIN@69 | Any::Moose::
1 | 1 | 1 | 11µs | 16µs | BEGIN@8 | Any::Moose::
1 | 1 | 1 | 6µs | 6µs | BEGIN@2 | Any::Moose::
0 | 0 | 0 | 0s | 0s | is_moose_loaded | Any::Moose::
0 | 0 | 0 | 0s | 0s | unimport | Any::Moose::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | 1 | 57µs | 2 | 49µs | package Any::Moose; # spent 45µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
2 | # spent 6µs within Any::Moose::BEGIN@2 which was called:
# once (6µs+0s) by hailo::BEGIN@6 at line 4 | ||||
3 | 1 | 6µs | $Any::Moose::VERSION = '0.13'; | ||
4 | 1 | 21µs | 1 | 6µs | } # spent 6µs making 1 call to Any::Moose::BEGIN@2 |
5 | 1 | 5µs | # ABSTRACT: use Moose or Mouse modules # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
6 | |||||
7 | 2 | 82µs | 3 | 58µs | # spent 27µs within Any::Moose::BEGIN@7 which was called:
# once (27µs+0s) by hailo::BEGIN@6 at line 7 # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 27µs making 1 call to Any::Moose::BEGIN@7
# spent 3µs making 1 call to Encode::Encoding::renewed |
8 | 2 | 25µs | 2 | 22µs | # spent 16µs (11+5) within Any::Moose::BEGIN@8 which was called:
# once (11µs+5µs) by hailo::BEGIN@6 at line 8 # spent 16µs making 1 call to Any::Moose::BEGIN@8
# spent 5µs making 1 call to strict::import |
9 | 2 | 26µs | 3 | 43µs | # spent 27µs (13+14) within Any::Moose::BEGIN@9 which was called:
# once (13µs+14µs) by hailo::BEGIN@6 at line 9 # spent 27µs making 1 call to Any::Moose::BEGIN@9
# spent 14µs making 1 call to warnings::import
# spent 2µs making 1 call to Encode::utf8::encode_xs |
10 | |||||
11 | 1 | 81µs | 2 | 30µs | # decide which backend to use # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
12 | 1 | 1µs | our $PREFERRED; | ||
13 | 1 | 3µs | do { | ||
14 | 1 | 1µs | local $@; | ||
15 | 1 | 9µs | 1 | 5µs | if ($ENV{ANY_MOOSE}) { # spent 5µs making 1 call to Any::Moose::_is_moose_loaded |
16 | $PREFERRED = $ENV{'ANY_MOOSE'}; | ||||
17 | warn "ANY_MOOSE is not set to Moose or Mouse" | ||||
18 | unless $PREFERRED eq 'Moose' | ||||
19 | 1 | 5µs | || $PREFERRED eq 'Mouse'; # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
20 | |||||
21 | 1 | 130µs | 2 | 29µs | # if we die here, then perl gives "unknown error" which doesn't tell # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
22 | # you what the problem is at all. argh. | ||||
23 | if ($PREFERRED eq 'Moose' && !eval { require Moose }) { | ||||
24 | warn "\$ANY_MOOSE is set to Moose but we cannot load it"; | ||||
25 | } | ||||
26 | elsif ($PREFERRED eq 'Mouse' && !eval { require Mouse }) { | ||||
27 | warn "\$ANY_MOOSE is set to Mouse but we cannot load it"; | ||||
28 | } | ||||
29 | } | ||||
30 | elsif (_is_moose_loaded()) { | ||||
31 | $PREFERRED = 'Moose'; | ||||
32 | } | ||||
33 | 1 | 137µs | elsif (eval { require Mouse }) { | ||
34 | 1 | 2µs | $PREFERRED = 'Mouse'; | ||
35 | } | ||||
36 | elsif (eval { require Moose }) { | ||||
37 | $PREFERRED = 'Moose'; | ||||
38 | } | ||||
39 | else { | ||||
40 | require Carp; | ||||
41 | warn "Unable to locate Mouse or Moose in INC"; | ||||
42 | } | ||||
43 | 1 | 2µs | }; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
44 | |||||
45 | 1 | 51µs | 2 | 36µs | # spent 60.7ms (714µs+60.0) within Any::Moose::import which was called 17 times, avg 3.57ms/call:
# once (39µs+51.6ms) by Hailo::Command::BEGIN@5 at line 5 of lib/Hailo/Command.pm
# once (42µs+1.09ms) by Hailo::Command::BEGIN@6 at line 6 of lib/Hailo/Command.pm
# once (50µs+753µs) by Hailo::Engine::Default::BEGIN@4 at line 4 of lib/Hailo/Engine/Default.pm
# once (50µs+671µs) by hailo::BEGIN@6 at line 6 of bin/hailo
# once (50µs+651µs) by Hailo::BEGIN@5 at line 5 of lib/Hailo.pm
# once (46µs+656µs) by Hailo::Storage::SQLite::BEGIN@4 at line 4 of lib/Hailo/Storage/SQLite.pm
# once (42µs+609µs) by Hailo::Tokenizer::Words::BEGIN@5 at line 5 of lib/Hailo/Tokenizer/Words.pm
# once (40µs+547µs) by Hailo::Storage::BEGIN@4 at line 4 of lib/Hailo/Storage.pm
# once (48µs+521µs) by Hailo::Role::Arguments::BEGIN@4 at line 4 of lib/Hailo/Role/Arguments.pm
# once (38µs+524µs) by Hailo::Command::BEGIN@4 at line 4 of lib/Hailo/Command.pm
# once (45µs+406µs) by Hailo::Role::Tokenizer::BEGIN@4 at line 4 of lib/Hailo/Role/Tokenizer.pm
# once (41µs+368µs) by Hailo::Role::Engine::BEGIN@4 at line 4 of lib/Hailo/Role/Engine.pm
# once (41µs+350µs) by Hailo::Role::Storage::BEGIN@4 at line 4 of lib/Hailo/Role/Storage.pm
# once (34µs+323µs) by Hailo::BEGIN@6.10 at line 6 of lib/Hailo.pm
# once (41µs+308µs) by Hailo::Storage::SQLite::BEGIN@5 at line 5 of lib/Hailo/Storage/SQLite.pm
# once (35µs+310µs) by Hailo::Tokenizer::Words::BEGIN@6 at line 6 of lib/Hailo/Tokenizer/Words.pm
# once (33µs+295µs) by Hailo::Storage::BEGIN@5 at line 5 of lib/Hailo/Storage.pm # spent 32µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
46 | 170 | 669µs | my $self = shift; | ||
47 | 1 | 2µs | my $pkg = caller; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
48 | |||||
49 | 1 | 47µs | 2 | 30µs | # Any::Moose gives you strict and warnings # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
50 | 17 | 77µs | strict->import; # spent 77µs making 17 calls to strict::import, avg 5µs/call | ||
51 | 18 | 189µs | warnings->import; # spent 187µs making 17 calls to warnings::import, avg 11µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
52 | |||||
53 | 1 | 51µs | 2 | 30µs | # first options are for Mo*se # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
54 | 1 | 5µs | unshift @_, 'Moose' if !@_ || ref($_[0]); # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
55 | |||||
56 | 1 | 53µs | 2 | 30µs | while (my $module = shift) { # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
57 | 1 | 2µs | my $options = @_ && ref($_[0]) ? shift : []; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
58 | |||||
59 | 1 | 60µs | 19 | 1.91ms | $options = $self->_canonicalize_options( # spent 1.88ms making 17 calls to Any::Moose::_canonicalize_options, avg 111µs/call
# spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
60 | module => $module, | ||||
61 | options => $options, | ||||
62 | package => $pkg, | ||||
63 | 1 | 8µs | ); # spent 8µs making 1 call to Encode::utf8::encode_xs | ||
64 | |||||
65 | 1 | 41µs | 19 | 57.9ms | $self->_install_module($options); # spent 57.8ms making 17 calls to Any::Moose::_install_module, avg 3.40ms/call
# spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
66 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
67 | |||||
68 | 1 | 44µs | 2 | 29µs | # give them any_moose too # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
69 | 2 | 56µs | 2 | 64µs | # spent 38µs (12+26) within Any::Moose::BEGIN@69 which was called:
# once (12µs+26µs) by hailo::BEGIN@6 at line 69 # spent 38µs making 1 call to Any::Moose::BEGIN@69
# spent 26µs making 1 call to strict::unimport |
70 | *{$pkg.'::any_moose'} = \&any_moose; | ||||
71 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
72 | |||||
73 | 1 | 48µs | 2 | 30µs | sub unimport { # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
74 | my $sel = shift; | ||||
75 | my $pkg = caller; | ||||
76 | 1 | 2µs | my $module; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
77 | |||||
78 | 1 | 87µs | 2 | 29µs | if(@_){ # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
79 | $module = any_moose(shift, $pkg); | ||||
80 | } | ||||
81 | else { | ||||
82 | $module = _backer_of($pkg); | ||||
83 | } | ||||
84 | my $e = do{ | ||||
85 | local $@; | ||||
86 | eval "package $pkg;\n" | ||||
87 | . '$module->unimport();'; | ||||
88 | $@; | ||||
89 | 1 | 2µs | }; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
90 | |||||
91 | 1 | 53µs | 2 | 29µs | if ($e) { # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
92 | require Carp; | ||||
93 | Carp::croak("Cannot unimport Any::Moose: $e"); | ||||
94 | 1 | 5µs | } # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
95 | |||||
96 | 1 | 52µs | 2 | 32µs | return; # spent 29µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
97 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
98 | |||||
99 | 1 | 42µs | 2 | 29µs | # spent 508µs (365+143) within Any::Moose::_backer_of which was called 19 times, avg 27µs/call:
# 19 times (365µs+143µs) by Any::Moose::any_moose at line 169, avg 27µs/call # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
100 | 114 | 381µs | 1 | 2µs | my $pkg = shift; # spent 2µs making 1 call to Encode::utf8::encode_xs |
101 | |||||
102 | 1 | 78µs | 2 | 29µs | if(exists $INC{'Mouse.pm'}){ # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
103 | 19 | 64µs | my $meta = Mouse::Util::get_metaclass_by_name($pkg); # spent 64µs making 19 calls to Mouse::Meta::Module::_get_metaclass_by_name, avg 3µs/call | ||
104 | if ($meta) { | ||||
105 | 8 | 25µs | return 'Mouse::Role' if $meta->isa('Mouse::Meta::Role'); # spent 25µs making 8 calls to UNIVERSAL::isa, avg 3µs/call | ||
106 | 8 | 11µs | return 'Mouse' if $meta->isa('Mouse::Meta::Class'); # spent 11µs making 8 calls to UNIVERSAL::isa, avg 1µs/call | ||
107 | } | ||||
108 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
109 | |||||
110 | 1 | 81µs | 13 | 72µs | if (_is_moose_loaded()) { # spent 43µs making 11 calls to Any::Moose::_is_moose_loaded, avg 4µs/call
# spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
111 | my $meta = Class::MOP::get_metaclass_by_name($pkg); | ||||
112 | if ($meta) { | ||||
113 | return 'Moose::Role' if $meta->isa('Moose::Meta::Role'); | ||||
114 | return 'Moose' if $meta->isa('Moose::Meta::Class'); | ||||
115 | } | ||||
116 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
117 | |||||
118 | 1 | 50µs | 2 | 33µs | return undef; # spent 30µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
119 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
120 | |||||
121 | 1 | 50µs | 2 | 29µs | # spent 1.88ms (415µs+1.47) within Any::Moose::_canonicalize_options which was called 17 times, avg 111µs/call:
# 17 times (415µs+1.47ms) by Any::Moose::import at line 59, avg 111µs/call # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
122 | 136 | 413µs | my $self = shift; | ||
123 | 1 | 2µs | my %args = @_; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
124 | |||||
125 | 1 | 72µs | 2 | 31µs | my %options; # spent 28µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
126 | if (ref($args{options}) eq 'HASH') { | ||||
127 | %options = %{ $args{options} }; | ||||
128 | } | ||||
129 | else { | ||||
130 | %options = ( | ||||
131 | imports => $args{options}, | ||||
132 | ); | ||||
133 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
134 | |||||
135 | 1 | 47µs | 2 | 32µs | $options{package} = $args{package}; # spent 29µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
136 | 18 | 1.47ms | $options{module} = any_moose($args{module}, $args{package}); # spent 1.47ms making 17 calls to Any::Moose::any_moose, avg 86µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
137 | |||||
138 | 1 | 52µs | 2 | 27µs | return \%options; # spent 24µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
139 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
140 | |||||
141 | 1 | 46µs | 2 | 35µs | # spent 57.8ms (1.89+55.9) within Any::Moose::_install_module which was called 17 times, avg 3.40ms/call:
# 17 times (1.89ms+55.9ms) by Any::Moose::import at line 65, avg 3.40ms/call # spent 32µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
142 | 187 | 1.22ms | my $self = shift; | ||
143 | 1 | 5µs | my $options = shift; # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
144 | |||||
145 | 1 | 60µs | 2 | 27µs | my $module = $options->{module}; # spent 23µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
146 | 18 | 43µs | (my $file = $module . '.pm') =~ s{::}{/}g; # spent 40µs making 17 calls to Any::Moose::CORE:subst, avg 2µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
147 | |||||
148 | 1 | 32µs | 3 | 27µs | require $file; # spent 22µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
149 | |||||
150 | 1 | 89µs | 2 | 24µs | my $e = do { # spent 21µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
151 | local $@; | ||||
152 | eval "package $options->{package};\n" # spent 25µs executing statements in 3 string evals (merged)
# spent 22µs executing statements in 2 string evals (merged)
# spent 19µs executing statements in 2 string evals (merged)
# spent 19µs executing statements in 2 string evals (merged)
# spent 16µs executing statements in 2 string evals (merged)
# spent 12µs executing statements in string eval
# spent 12µs executing statements in string eval
# spent 11µs executing statements in string eval
# spent 10µs executing statements in string eval
# spent 9µs executing statements in string eval
# spent 8µs executing statements in string eval | ||||
153 | . '$module->import(@{ $options->{imports} });'; | ||||
154 | $@; | ||||
155 | }; | ||||
156 | if ($e) { | ||||
157 | require Carp; | ||||
158 | Carp::croak("Cannot import Any::Moose: $e"); | ||||
159 | } | ||||
160 | return; | ||||
161 | 1 | 5µs | } # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
162 | |||||
163 | 1 | 49µs | 2 | 21µs | # spent 1.63ms (477µs+1.15) within Any::Moose::any_moose which was called 19 times, avg 86µs/call:
# 17 times (433µs+1.03ms) by Any::Moose::_canonicalize_options at line 136, avg 86µs/call
# once (23µs+60µs) by hailo::BEGIN@8 at line 11 of lib/Hailo/Command.pm
# once (20µs+56µs) by hailo::BEGIN@8 at line 18 of lib/Hailo/Command.pm # spent 18µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
164 | 125 | 547µs | 19 | 521µs | my $fragment = _canonicalize_fragment(shift); # spent 521µs making 19 calls to Any::Moose::_canonicalize_fragment, avg 27µs/call |
165 | 1 | 2µs | my $package = shift || caller; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
166 | |||||
167 | 1 | 22µs | 3 | 24µs | # Mouse gets first dibs because it doesn't introspect existing classes # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
168 | |||||
169 | 1 | 30µs | 22 | 527µs | my $backer = _backer_of($package) || ''; # spent 508µs making 19 calls to Any::Moose::_backer_of, avg 27µs/call
# spent 14µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
170 | |||||
171 | 1 | 49µs | 21 | 49µs | if ($backer =~ /^Mouse/) { # spent 32µs making 19 calls to Any::Moose::CORE:match, avg 2µs/call
# spent 14µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
172 | 8 | 13µs | $fragment =~ s/^Moose/Mouse/; # spent 13µs making 8 calls to Any::Moose::CORE:subst, avg 2µs/call | ||
173 | return $fragment; | ||||
174 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
175 | |||||
176 | 1 | 31µs | 14 | 31µs | return $fragment if $backer =~ /^Moose/; # spent 13µs making 11 calls to Any::Moose::CORE:match, avg 1µs/call
# spent 12µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
177 | |||||
178 | 1 | 51µs | 24 | 76µs | $fragment =~ s/^Moose/Mouse/ if mouse_is_preferred(); # spent 38µs making 11 calls to Any::Moose::mouse_is_preferred, avg 3µs/call
# spent 24µs making 11 calls to Any::Moose::CORE:subst, avg 2µs/call
# spent 11µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
179 | return $fragment; | ||||
180 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
181 | |||||
182 | 1 | 75µs | 4 | 40µs | for my $name (qw/ # spent 34µs making 2 calls to Encode::utf8::decode_xs, avg 17µs/call
# spent 6µs making 2 calls to Encode::Encoding::renewed, avg 3µs/call |
183 | load_class | ||||
184 | is_class_loaded | ||||
185 | class_of | ||||
186 | get_metaclass_by_name | ||||
187 | get_all_metaclass_instances | ||||
188 | get_all_metaclass_names | ||||
189 | load_first_existing_class | ||||
190 | /) { | ||||
191 | 2 | 78µs | 2 | 72µs | # spent 47µs (23+25) within Any::Moose::BEGIN@191 which was called:
# once (23µs+25µs) by hailo::BEGIN@6 at line 191 # spent 47µs making 1 call to Any::Moose::BEGIN@191
# spent 25µs making 1 call to strict::unimport |
192 | *{__PACKAGE__."::$name"} = moose_is_preferred() | ||||
193 | ? *{"Class::MOP::$name"} | ||||
194 | 7 | 59µs | 7 | 20µs | : *{"Mouse::Util::$name"}; # spent 20µs making 7 calls to Any::Moose::moose_is_preferred, avg 3µs/call |
195 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
196 | |||||
197 | 10 | 111µs | 2 | 34µs | # spent 35µs within Any::Moose::moose_is_preferred which was called 10 times, avg 3µs/call:
# 7 times (20µs+0s) by hailo::BEGIN@6 at line 194, avg 3µs/call
# 3 times (15µs+0s) by Hailo::_new_class at line 193 of lib/Hailo.pm, avg 5µs/call # spent 31µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
198 | 11 | 45µs | 1 | 2µs | # spent 38µs within Any::Moose::mouse_is_preferred which was called 11 times, avg 3µs/call:
# 11 times (38µs+0s) by Any::Moose::any_moose at line 178, avg 3µs/call # spent 2µs making 1 call to Encode::utf8::encode_xs |
199 | |||||
200 | 12 | 110µs | 3 | 35µs | sub _is_moose_loaded { exists $INC{'Moose.pm'} } # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 5µs making 1 call to Encode::utf8::encode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
201 | |||||
202 | 1 | 62µs | 2 | 30µs | sub is_moose_loaded { # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
203 | require Carp; | ||||
204 | Carp::carp("Any::Moose::is_moose_loaded is deprecated. Please use Any::Moose::moose_is_preferred instead"); | ||||
205 | goto \&_is_moose_loaded; | ||||
206 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
207 | |||||
208 | 1 | 45µs | 2 | 29µs | # spent 521µs (384+138) within Any::Moose::_canonicalize_fragment which was called 19 times, avg 27µs/call:
# 19 times (384µs+138µs) by Any::Moose::any_moose at line 164, avg 27µs/call # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
209 | 133 | 533µs | 1 | 6µs | my $fragment = shift; # spent 6µs making 1 call to Encode::utf8::encode_xs |
210 | |||||
211 | 1 | 44µs | 3 | 36µs | return 'Moose' if !$fragment; # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 8µs making 1 call to Encode::utf8::encode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
212 | |||||
213 | 1 | 49µs | 2 | 30µs | # any_moose("X::Types") -> any_moose("MooseX::Types") # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
214 | 20 | 49µs | $fragment =~ s/^X::/MooseX::/; # spent 47µs making 19 calls to Any::Moose::CORE:subst, avg 2µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
215 | |||||
216 | 1 | 48µs | 2 | 30µs | # any_moose("::Util") -> any_moose("Moose::Util") # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
217 | 20 | 32µs | $fragment =~ s/^::/Moose::/; # spent 30µs making 19 calls to Any::Moose::CORE:subst, avg 2µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
218 | |||||
219 | 1 | 52µs | 2 | 33µs | # any_moose("Mouse::Util") -> any_moose("Moose::Util") # spent 29µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
220 | 20 | 27µs | $fragment =~ s/^Mouse(X?)\b/Moose$1/; # spent 24µs making 19 calls to Any::Moose::CORE:subst, avg 1µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
221 | |||||
222 | 1 | 44µs | 2 | 31µs | # any_moose("Util") -> any_moose("Moose::Util") # spent 27µs making 1 call to Encode::utf8::decode_xs
# spent 4µs making 1 call to Encode::Encoding::renewed |
223 | 20 | 39µs | $fragment =~ s/^(?!Moose)/Moose::/; # spent 36µs making 19 calls to Any::Moose::CORE:subst, avg 2µs/call
# spent 2µs making 1 call to Encode::utf8::encode_xs | ||
224 | |||||
225 | 1 | 46µs | 2 | 28µs | return $fragment; # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
226 | 1 | 2µs | } # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
227 | |||||
228 | 1 | 54µs | 3 | 31µs | 1; # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
229 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
230 | 1 | 32µs | 2 | 28µs | # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
231 | 1 | 35µs | 3 | 34µs | =pod # spent 29µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
232 | |||||
233 | 1 | 32µs | 3 | 37µs | =head1 NAME # spent 32µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
234 | |||||
235 | 1 | 32µs | 3 | 31µs | Any::Moose - use Moose or Mouse modules # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
236 | |||||
237 | 1 | 32µs | 3 | 31µs | =head1 VERSION # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
238 | |||||
239 | 1 | 32µs | 3 | 31µs | version 0.13 # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
240 | |||||
241 | 1 | 35µs | 3 | 30µs | =head1 SYNOPSIS # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
242 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
243 | 1 | 37µs | 2 | 31µs | # spent 28µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
244 | 1 | 32µs | 3 | 31µs | =head2 BASIC # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
245 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
246 | 1 | 35µs | 2 | 28µs | # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
247 | 1 | 32µs | 3 | 31µs | package Class; # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
248 | |||||
249 | 1 | 32µs | 2 | 28µs | # uses Moose if it's loaded or demanded, Mouse otherwise # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
250 | 1 | 2µs | use Any::Moose; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
251 | |||||
252 | 1 | 37µs | 2 | 28µs | # cleans the namespace up # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
253 | 1 | 2µs | no Any::Moose; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
254 | |||||
255 | 1 | 32µs | 3 | 31µs | =head2 OTHER MODULES # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
256 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
257 | 1 | 31µs | 2 | 27µs | # spent 24µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
258 | 1 | 33µs | 2 | 27µs | package Other::Class; # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
259 | 1 | 2µs | use Any::Moose; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
260 | |||||
261 | 1 | 33µs | 2 | 27µs | # uses Moose::Util::TypeConstraints if the class has loaded Moose, # spent 24µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
262 | # Mouse::Util::TypeConstraints otherwise. | ||||
263 | 1 | 2µs | use Any::Moose '::Util::TypeConstraints'; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
264 | |||||
265 | 1 | 35µs | 3 | 33µs | =head2 ROLES # spent 28µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
266 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
267 | 1 | 32µs | 2 | 34µs | # spent 28µs making 1 call to Encode::utf8::decode_xs
# spent 6µs making 1 call to Encode::Encoding::renewed |
268 | 1 | 32µs | 2 | 28µs | package My::Sorter; # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
269 | 1 | 2µs | use Any::Moose 'Role'; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
270 | |||||
271 | 1 | 32µs | 3 | 31µs | requires 'cmp'; # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
272 | |||||
273 | 1 | 36µs | 3 | 30µs | =head2 COMPLEX USAGE # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
274 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
275 | 1 | 30µs | 2 | 28µs | # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
276 | 1 | 33µs | 2 | 31µs | package My::Meta::Class; # spent 28µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
277 | 1 | 2µs | use Any::Moose; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
278 | |||||
279 | 1 | 35µs | 2 | 29µs | # uses subtype from Moose::Util::TypeConstraints if the class loaded Moose, # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
280 | # subtype from Mouse::Util::TypeConstraints otherwise. | ||||
281 | # similarly for Mo*se::Util's does_role | ||||
282 | use Any::Moose ( | ||||
283 | '::Util::TypeConstraints' => ['subtype'], | ||||
284 | '::Util' => ['does_role'], | ||||
285 | 1 | 2µs | ); # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
286 | |||||
287 | 1 | 33µs | 2 | 28µs | # uses MouseX::Types or MooseX::Types # spent 25µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
288 | 1 | 2µs | use Any::Moose 'X::Types'; # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
289 | |||||
290 | 1 | 33µs | 2 | 32µs | # gives you the right class name depending on which Mo*se was loaded # spent 29µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
291 | 1 | 2µs | extends any_moose('::Meta::Class'); # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
292 | |||||
293 | 1 | 47µs | 3 | 31µs | =head1 DESCRIPTION # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
294 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
295 | 1 | 32µs | 2 | 38µs | # spent 35µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
296 | 1 | 34µs | 2 | 29µs | Though we recommend that people generally use L<Moose>, we accept that Moose # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
297 | cannot yet be used for everything everywhere. People generally like the Moose | ||||
298 | sugar, so many people use L<Mouse>, a lightweight replacement for parts of | ||||
299 | 1 | 2µs | Moose. # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
300 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
301 | 1 | 31µs | 2 | 29µs | # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
302 | 1 | 44µs | 2 | 38µs | Because Mouse strives for compatibility with Moose, it's easy to substitute one # spent 35µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
303 | for the other. This module facilitates that substitution. By default, Mouse | ||||
304 | will be provided to libraries, unless Moose is already loaded -or- | ||||
305 | explicitly requested by the end-user. The end-user can force the decision | ||||
306 | of which backend to use by setting the environment variable C<ANY_MOOSE> to | ||||
307 | 1 | 2µs | be C<Moose> or C<Mouse>. # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
308 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
309 | 1 | 33µs | 2 | 30µs | # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
310 | 1 | 33µs | 2 | 29µs | Note that the decision of which backend to use is made only once, so that if # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
311 | Any-Moose picks Mouse, then a third-party library loads Moose, anything else | ||||
312 | 1 | 2µs | that uses Any-Moose will continue to pick Mouse. # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
313 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
314 | 1 | 28µs | 2 | 30µs | # spent 26µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
315 | 1 | 29µs | 2 | 25µs | So, if you have to use L<Mouse>, please be considerate to the Moose fanboys # spent 22µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
316 | 1 | 2µs | (like myself!) and use L<Any-Moose> instead. C<:)> # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
317 | |||||
318 | 1 | 27µs | 3 | 30µs | =head1 SEE ALSO # spent 24µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
319 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
320 | 1 | 26µs | 2 | 24µs | # spent 20µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
321 | 1 | 26µs | 3 | 24µs | L<Moose> # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
322 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
323 | 1 | 25µs | 2 | 21µs | # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
324 | 1 | 29µs | 3 | 24µs | L<Mouse> # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
325 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
326 | 1 | 24µs | 2 | 22µs | # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
327 | 1 | 30µs | 2 | 22µs | L<Squirrel> - a deprecated first-stab at Any-Moose-like logic. Its biggest # spent 19µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
328 | fault was in making the decision of which backend to use every time it was | ||||
329 | 1 | 5µs | used, rather than just once. # spent 5µs making 1 call to Encode::utf8::encode_xs | ||
330 | |||||
331 | 1 | 23µs | 3 | 22µs | =head1 AUTHORS # spent 17µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
332 | |||||
333 | 1 | 24µs | 2 | 19µs | Shawn M Moore <sartak@bestpractical.com> # spent 16µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
334 | Florian Ragwitz <rafl@debian.org> | ||||
335 | Stevan Little <stevan@iinteractive.com> | ||||
336 | Tokuhiro Matsuno <tokuhirom@gmail.com> | ||||
337 | 1 | 2µs | Goro Fuji <gfuji@cpan.org> # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
338 | |||||
339 | 1 | 20µs | 3 | 19µs | =head1 COPYRIGHT AND LICENSE # spent 14µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
340 | |||||
341 | 1 | 19µs | 3 | 17µs | This software is copyright (c) 2010 by Best Practical Solutions. # spent 13µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
342 | |||||
343 | 1 | 18µs | 2 | 14µs | This is free software; you can redistribute it and/or modify it under # spent 11µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
344 | 1 | 2µs | the same terms as the Perl 5 programming language system itself. # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
345 | |||||
346 | 1 | 15µs | 3 | 15µs | =cut # spent 10µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed
# spent 2µs making 1 call to Encode::utf8::encode_xs |
347 | 1 | 2µs | # spent 2µs making 1 call to Encode::utf8::encode_xs | ||
348 | 1 | 15µs | 2 | 12µs | # spent 9µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
349 | 1 | 42µs | 2 | 13µs | __END__ # spent 10µs making 1 call to Encode::utf8::decode_xs
# spent 3µs making 1 call to Encode::Encoding::renewed |
350 | |||||
sub Any::Moose::CORE:match; # opcode | |||||
# spent 214µs within Any::Moose::CORE:subst which was called 112 times, avg 2µs/call:
# 19 times (47µs+0s) by Any::Moose::_canonicalize_fragment at line 214, avg 2µs/call
# 19 times (36µs+0s) by Any::Moose::_canonicalize_fragment at line 223, avg 2µs/call
# 19 times (30µs+0s) by Any::Moose::_canonicalize_fragment at line 217, avg 2µs/call
# 19 times (24µs+0s) by Any::Moose::_canonicalize_fragment at line 220, avg 1µs/call
# 17 times (40µs+0s) by Any::Moose::_install_module at line 146, avg 2µs/call
# 11 times (24µs+0s) by Any::Moose::any_moose at line 178, avg 2µs/call
# 8 times (13µs+0s) by Any::Moose::any_moose at line 172, avg 2µs/call |