← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/bin/epoll_server.pl
  Run on Wed Jan 5 05:34:33 2011
Reported on Wed Jan 5 05:39:23 2011

File /usr/lib/perl5/vendor_perl/5.10.1/Config/Any/Base.pm
Statements Executed 16
Statement Execution Time 1.42ms
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1114.62ms129msConfig::Any::Base::::is_supportedConfig::Any::Base::is_supported
11188µs102µsConfig::Any::Base::::BEGIN@3Config::Any::Base::BEGIN@3
11131µs89µsConfig::Any::Base::::BEGIN@4Config::Any::Base::BEGIN@4
11117µs17µsConfig::Any::Base::::_require_lineConfig::Any::Base::_require_line
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Config::Any::Base;
2
3386µs2116µs
# spent 102µs (88+14) within Config::Any::Base::BEGIN@3 which was called # once (88µs+14µs) by base::import at line 3
use strict;
# spent 102µs making 1 call to Config::Any::Base::BEGIN@3 # spent 14µs making 1 call to strict::import
43746µs2147µs
# spent 89µs (31+58) within Config::Any::Base::BEGIN@4 which was called # once (31µs+58µs) by base::import at line 4
use warnings;
# spent 89µs making 1 call to Config::Any::Base::BEGIN@4 # spent 58µs making 1 call to warnings::import
5
6=head1 NAME
7
8Config::Any::Base - Base class for loaders
9
10=head1 DESCRIPTION
11
12This is a base class for all loaders. It currently handles the specification
13of dependencies in order to ensure the subclass can load the config file
14format.
15
16=head1 METHODS
17
18=head2 is_supported( )
19
20Allows us to determine if the file format can be loaded. The can be done via
21one of two subclass methds:
22
23=over 4
24
25=item * C<requires_all_of()> - returns an array of items that must all be present in order to work
26
27=item * C<requires_any_of()> - returns an array of items in which at least one must be present
28
29=back
30
31You can specify a module version by passing an array reference in the return.
32
33 sub requires_all_of { [ 'My::Module', '1.1' ], 'My::OtherModule' }
34
35Lack of specifying these subs will assume you require no extra modules to function.
36
37=cut
38
39
# spent 129ms (4.62+124) within Config::Any::Base::is_supported which was called # once (4.62ms+124ms) by Config::Any::_load at line 195 of Config/Any.pm
sub is_supported {
40359µs my ( $class ) = shift;
41 if ( $class->can( 'requires_all_of' ) ) {
# spent 12µs making 1 call to UNIVERSAL::can
42 eval join( '', map { _require_line( $_ ) } $class->requires_all_of );
43 return $@ ? 0 : 1;
44 }
4519µs16µs if ( $class->can( 'requires_any_of' ) ) {
# spent 6µs making 1 call to UNIVERSAL::can
46 for ( $class->requires_any_of ) {
# spent 9µs making 1 call to Config::Any::YAML::requires_any_of
472493µs117µs eval _require_line( $_ );
# spent 17µs making 1 call to Config::Any::Base::_require_line
48 return 1 unless $@;
49 }
50 return 0;
51 }
52
53 # requires nothing!
54 return 1;
55}
56
57
# spent 17µs within Config::Any::Base::_require_line which was called # once (17µs+0s) by Config::Any::Base::is_supported at line 47
sub _require_line {
58323µs my ( $input ) = shift;
59 my ( $module, $version ) = ( ref $input ? @$input : $input );
60 return "require $module;"
61 . ( $version ? "${module}->VERSION('${version}');" : '' );
62}
63
64=head1 AUTHOR
65
66Brian Cassidy E<lt>bricas@cpan.orgE<gt>
67
68=head1 COPYRIGHT AND LICENSE
69
70Copyright 2008-2009 by Brian Cassidy
71
72This library is free software; you can redistribute it and/or modify
73it under the same terms as Perl itself.
74
75=head1 SEE ALSO
76
77=over 4
78
79=item * L<Config::Any>
80
81=back
82
83=cut
84
8518µs1;