← Index
NYTProf Performance Profile   « block view • line view • sub view »
For bin/hailo
  Run on Thu Oct 21 22:50:37 2010
Reported on Thu Oct 21 22:52:06 2010

Filename/home/hinrik/perl5/perlbrew/perls/perl-5.13.5/lib/site_perl/5.13.5/Any/Moose.pm
StatementsExecuted 924 statements in 8.41ms
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
17111.89ms57.8msAny::Moose::::_install_moduleAny::Moose::_install_module
171711714µs60.7msAny::Moose::::importAny::Moose::import
1932477µs1.63msAny::Moose::::any_mooseAny::Moose::any_moose
1711415µs1.88msAny::Moose::::_canonicalize_optionsAny::Moose::_canonicalize_options
1911384µs521µsAny::Moose::::_canonicalize_fragmentAny::Moose::_canonicalize_fragment
1911365µs508µsAny::Moose::::_backer_ofAny::Moose::_backer_of
11271214µs214µsAny::Moose::::CORE:substAny::Moose::CORE:subst (opcode)
122148µs48µsAny::Moose::::_is_moose_loadedAny::Moose::_is_moose_loaded
302146µs46µsAny::Moose::::CORE:matchAny::Moose::CORE:match (opcode)
111138µs38µsAny::Moose::::mouse_is_preferredAny::Moose::mouse_is_preferred
102235µs35µsAny::Moose::::moose_is_preferredAny::Moose::moose_is_preferred
11127µs27µsAny::Moose::::BEGIN@7Any::Moose::BEGIN@7
11123µs47µsAny::Moose::::BEGIN@191Any::Moose::BEGIN@191
11113µs27µsAny::Moose::::BEGIN@9Any::Moose::BEGIN@9
11112µs38µsAny::Moose::::BEGIN@69Any::Moose::BEGIN@69
11111µs16µsAny::Moose::::BEGIN@8Any::Moose::BEGIN@8
1116µs6µsAny::Moose::::BEGIN@2Any::Moose::BEGIN@2
0000s0sAny::Moose::::is_moose_loadedAny::Moose::is_moose_loaded
0000s0sAny::Moose::::unimportAny::Moose::unimport
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1157µs249µspackage 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
BEGIN {
316µs $Any::Moose::VERSION = '0.13';
4121µs16µs}
# spent 6µs making 1 call to Any::Moose::BEGIN@2
515µs# ABSTRACT: use Moose or Mouse modules
# spent 5µs making 1 call to Encode::utf8::encode_xs
6
7282µs358µs
# spent 27µs within Any::Moose::BEGIN@7 which was called: # once (27µs+0s) by hailo::BEGIN@6 at line 7
use 5.006_002;
# 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
8225µs222µ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
use strict;
# spent 16µs making 1 call to Any::Moose::BEGIN@8 # spent 5µs making 1 call to strict::import
9226µs343µ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
use warnings;
# 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
11181µs230µ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
1211µsour $PREFERRED;
13313µsdo {
14 local $@;
152139µs15µ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'
1915µs || $PREFERRED eq 'Mouse';
# spent 5µs making 1 call to Encode::utf8::encode_xs
20
211130µs229µ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 elsif (eval { require Mouse }) {
34 $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 }
4312µs};
# spent 2µs making 1 call to Encode::utf8::encode_xs
44
45151µs236µ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
sub import {
# spent 32µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
46119464µs my $self = shift;
4712µs my $pkg = caller;
# spent 2µs making 1 call to Encode::utf8::encode_xs
48
49147µs230µ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
501777µs strict->import;
# spent 77µs making 17 calls to strict::import, avg 5µs/call
5118189µ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
53151µs230µ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
5415µs unshift @_, 'Moose' if !@_ || ref($_[0]);
# spent 5µs making 1 call to Encode::utf8::encode_xs
55
5651258µs230µ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
5712µs my $options = @_ && ref($_[0]) ? shift : [];
# spent 2µs making 1 call to Encode::utf8::encode_xs
58
59160µs191.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,
6318µs );
# spent 8µs making 1 call to Encode::utf8::encode_xs
64
65141µs1957.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
6612µs }
# spent 2µs making 1 call to Encode::utf8::encode_xs
67
68144µs229µ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
69256µs264µ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
no strict 'refs';
# 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;
7112µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
72
73148µs230µssub 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;
7612µs my $module;
# spent 2µs making 1 call to Encode::utf8::encode_xs
77
78187µs229µ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 $@;
8912µs };
# spent 2µs making 1 call to Encode::utf8::encode_xs
90
91153µs229µ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");
9415µs }
# spent 5µs making 1 call to Encode::utf8::encode_xs
95
96152µs232µs return;
# spent 29µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
9712µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
98
99142µs229µ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
sub _backer_of {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
10060155µs12µs my $pkg = shift;
# spent 2µs making 1 call to Encode::utf8::encode_xs
101
10238175µs229µ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
1031964µ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
10416129µs if ($meta) {
105825µs return 'Mouse::Role' if $meta->isa('Mouse::Meta::Role');
# spent 25µs making 8 calls to UNIVERSAL::isa, avg 3µs/call
106811µs return 'Mouse' if $meta->isa('Mouse::Meta::Class');
# spent 11µs making 8 calls to UNIVERSAL::isa, avg 1µs/call
107 }
10812µs }
# spent 2µs making 1 call to Encode::utf8::encode_xs
109
110181µs1372µ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 }
11612µs }
# spent 2µs making 1 call to Encode::utf8::encode_xs
117
118150µs233µs return undef;
# spent 30µs making 1 call to Encode::utf8::decode_xs # spent 4µs making 1 call to Encode::Encoding::renewed
11912µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
120
121150µs229µ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
sub _canonicalize_options {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
122119344µs my $self = shift;
12312µs my %args = @_;
# spent 2µs making 1 call to Encode::utf8::encode_xs
124
125172µs231µs my %options;
# spent 28µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
1261769µs if (ref($args{options}) eq 'HASH') {
127 %options = %{ $args{options} };
128 }
129 else {
130 %options = (
131 imports => $args{options},
132 );
13312µs }
# spent 2µs making 1 call to Encode::utf8::encode_xs
134
135147µs232µ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
136181.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
138152µs227µs return \%options;
# spent 24µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
13912µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
140
141146µs235µ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
sub _install_module {
# spent 32µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
142136564µs my $self = shift;
14315µs my $options = shift;
# spent 5µs making 1 call to Encode::utf8::encode_xs
144
145160µs227µ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
1461843µ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
148132µs327µ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
15051742µs224µ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;
16115µs}
# spent 5µs making 1 call to Encode::utf8::encode_xs
162
163149µs221µ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
sub any_moose {
# spent 18µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
164109474µs19521µs my $fragment = _canonicalize_fragment(shift);
# spent 521µs making 19 calls to Any::Moose::_canonicalize_fragment, avg 27µs/call
16512µs my $package = shift || caller;
# spent 2µs making 1 call to Encode::utf8::encode_xs
166
167122µs324µ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
169130µs22527µ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
17116121µs2149µ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
172813µs $fragment =~ s/^Moose/Mouse/;
# spent 13µs making 8 calls to Any::Moose::CORE:subst, avg 2µs/call
173 return $fragment;
17412µs }
# spent 2µs making 1 call to Encode::utf8::encode_xs
175
176131µs1431µ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
178151µs2476µ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;
18012µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
181
182175µs440µsfor 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 /) {
191278µs272µ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
no strict 'refs';
# 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"}
194759µs720µs : *{"Mouse::Util::$name"};
# spent 20µs making 7 calls to Any::Moose::moose_is_preferred, avg 3µs/call
19512µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
196
19710111µs234µ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
sub moose_is_preferred { $PREFERRED eq 'Moose' }
# spent 31µs making 1 call to Encode::utf8::decode_xs # spent 4µs making 1 call to Encode::Encoding::renewed
1981145µs12µ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
sub mouse_is_preferred { $PREFERRED eq 'Mouse' }
# spent 2µs making 1 call to Encode::utf8::encode_xs
199
20012110µs335µs
# spent 48µs within Any::Moose::_is_moose_loaded which was called 12 times, avg 4µs/call: # 11 times (43µs+0s) by Any::Moose::_backer_of at line 110, avg 4µs/call # once (5µs+0s) by hailo::BEGIN@6 at line 15
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
202162µs230µssub 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;
20612µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
207
208145µs229µ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
sub _canonicalize_fragment {
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
209133533µs16µs my $fragment = shift;
# spent 6µs making 1 call to Encode::utf8::encode_xs
210
211144µs336µ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
213149µs230µ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
2142049µ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
216148µs230µ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
2172032µ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
219152µs233µ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
2202027µ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
222144µs231µ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
2232039µ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
225146µs228µs return $fragment;
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
22612µs}
# spent 2µs making 1 call to Encode::utf8::encode_xs
227
228154µs331µs1;
# 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
22912µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
230132µs228µs
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
231135µs334µ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
233132µs337µ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
235132µs331µsAny::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
237132µs331µ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
239132µs331µsversion 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
241135µs330µ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
24212µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
243137µs231µs
# spent 28µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
244132µs331µ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
24512µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
246135µs228µs
# spent 25µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
247132µs331µ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
249132µs228µ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
25012µs use Any::Moose;
# spent 2µs making 1 call to Encode::utf8::encode_xs
251
252137µs228µ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
25312µs no Any::Moose;
# spent 2µs making 1 call to Encode::utf8::encode_xs
254
255132µs331µ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
25612µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
257131µs227µs
# spent 24µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
258133µs227µ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
25912µs use Any::Moose;
# spent 2µs making 1 call to Encode::utf8::encode_xs
260
261133µs227µ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.
26312µs use Any::Moose '::Util::TypeConstraints';
# spent 2µs making 1 call to Encode::utf8::encode_xs
264
265135µs333µ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
26612µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
267132µs234µs
# spent 28µs making 1 call to Encode::utf8::decode_xs # spent 6µs making 1 call to Encode::Encoding::renewed
268132µs228µ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
26912µs use Any::Moose 'Role';
# spent 2µs making 1 call to Encode::utf8::encode_xs
270
271132µs331µ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
273136µs330µ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
27412µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
275130µs228µs
# spent 25µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
276133µs231µ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
27712µs use Any::Moose;
# spent 2µs making 1 call to Encode::utf8::encode_xs
278
279135µs229µ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'],
28512µs );
# spent 2µs making 1 call to Encode::utf8::encode_xs
286
287133µs228µ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
28812µs use Any::Moose 'X::Types';
# spent 2µs making 1 call to Encode::utf8::encode_xs
289
290133µs232µ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
29112µs extends any_moose('::Meta::Class');
# spent 2µs making 1 call to Encode::utf8::encode_xs
292
293147µs331µ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
29412µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
295132µs238µs
# spent 35µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
296134µs229µsThough 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
297cannot yet be used for everything everywhere. People generally like the Moose
298sugar, so many people use L<Mouse>, a lightweight replacement for parts of
29912µsMoose.
# spent 2µs making 1 call to Encode::utf8::encode_xs
30012µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
301131µs229µs
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
302144µs238µsBecause 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
303for the other. This module facilitates that substitution. By default, Mouse
304will be provided to libraries, unless Moose is already loaded -or-
305explicitly requested by the end-user. The end-user can force the decision
306of which backend to use by setting the environment variable C<ANY_MOOSE> to
30712µsbe C<Moose> or C<Mouse>.
# spent 2µs making 1 call to Encode::utf8::encode_xs
30812µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
309133µs230µs
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
310133µs229µsNote 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
311Any-Moose picks Mouse, then a third-party library loads Moose, anything else
31212µsthat uses Any-Moose will continue to pick Mouse.
# spent 2µs making 1 call to Encode::utf8::encode_xs
31312µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
314128µs230µs
# spent 26µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
315129µs225µsSo, 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
31612µs(like myself!) and use L<Any-Moose> instead. C<:)>
# spent 2µs making 1 call to Encode::utf8::encode_xs
317
318127µs330µ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
31912µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
320126µs224µs
# spent 20µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
321126µs324µsL<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
32212µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
323125µs221µs
# spent 19µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
324129µs324µsL<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
32512µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
326124µs222µs
# spent 19µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
327130µs222µsL<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
328fault was in making the decision of which backend to use every time it was
32915µsused, rather than just once.
# spent 5µs making 1 call to Encode::utf8::encode_xs
330
331123µs322µ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
333124µs219µ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>
33712µs Goro Fuji <gfuji@cpan.org>
# spent 2µs making 1 call to Encode::utf8::encode_xs
338
339120µs319µ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
341119µs317µsThis 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
343118µs214µsThis 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
34412µsthe same terms as the Perl 5 programming language system itself.
# spent 2µs making 1 call to Encode::utf8::encode_xs
345
346115µs315µ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
34712µs
# spent 2µs making 1 call to Encode::utf8::encode_xs
348115µs212µs
# spent 9µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
349142µs213µs__END__
# spent 10µs making 1 call to Encode::utf8::decode_xs # spent 3µs making 1 call to Encode::Encoding::renewed
350
 
# spent 46µs within Any::Moose::CORE:match which was called 30 times, avg 2µs/call: # 19 times (32µs+0s) by Any::Moose::any_moose at line 171, avg 2µs/call # 11 times (13µs+0s) by Any::Moose::any_moose at line 176, avg 1µs/call
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
sub Any::Moose::CORE:subst; # opcode