| File | /usr/lib/perl5/vendor_perl/5.10.1/Config/Any/Perl.pm |
| Statements Executed | 12 |
| Statement Execution Time | 582µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 84µs | 140µs | Config::Any::Perl::BEGIN@4 |
| 1 | 1 | 1 | 48µs | 60µs | Config::Any::Perl::BEGIN@3 |
| 1 | 1 | 1 | 28µs | 206µs | Config::Any::Perl::BEGIN@6 |
| 2 | 2 | 1 | 13µs | 13µs | Config::Any::Perl::extensions |
| 0 | 0 | 0 | 0s | 0s | Config::Any::Perl::load |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Config::Any::Perl; | ||||
| 2 | |||||
| 3 | 3 | 82µs | 2 | 72µs | # spent 60µs (48+12) within Config::Any::Perl::BEGIN@3 which was called
# once (48µs+12µs) by Module::Pluggable::Object::_require at line 3 # spent 60µs making 1 call to Config::Any::Perl::BEGIN@3
# spent 12µs making 1 call to strict::import |
| 4 | 3 | 142µs | 2 | 197µs | # spent 140µs (84+57) within Config::Any::Perl::BEGIN@4 which was called
# once (84µs+57µs) by Module::Pluggable::Object::_require at line 4 # spent 140µs making 1 call to Config::Any::Perl::BEGIN@4
# spent 57µs making 1 call to warnings::import |
| 5 | |||||
| 6 | 3 | 312µs | 2 | 383µs | # spent 206µs (28+178) within Config::Any::Perl::BEGIN@6 which was called
# once (28µs+178µs) by Module::Pluggable::Object::_require at line 6 # spent 206µs making 1 call to Config::Any::Perl::BEGIN@6
# spent 178µs making 1 call to base::import |
| 7 | |||||
| 8 | =head1 NAME | ||||
| 9 | |||||
| 10 | Config::Any::Perl - Load Perl config files | ||||
| 11 | |||||
| 12 | =head1 DESCRIPTION | ||||
| 13 | |||||
| 14 | Loads Perl files. Example: | ||||
| 15 | |||||
| 16 | { | ||||
| 17 | name => 'TestApp', | ||||
| 18 | 'Controller::Foo' => { | ||||
| 19 | foo => 'bar' | ||||
| 20 | }, | ||||
| 21 | 'Model::Baz' => { | ||||
| 22 | qux => 'xyzzy' | ||||
| 23 | } | ||||
| 24 | } | ||||
| 25 | |||||
| 26 | =head1 METHODS | ||||
| 27 | |||||
| 28 | =head2 extensions( ) | ||||
| 29 | |||||
| 30 | return an array of valid extensions (C<pl>, C<perl>). | ||||
| 31 | |||||
| 32 | =cut | ||||
| 33 | |||||
| 34 | # spent 13µs within Config::Any::Perl::extensions which was called 2 times, avg 7µs/call:
# once (7µs+0s) by Config::Any::_load at line 154 of Config/Any.pm
# once (7µs+0s) by Config::Any::extensions at line 286 of Config/Any.pm | ||||
| 35 | 2 | 38µs | return qw( pl perl ); | ||
| 36 | } | ||||
| 37 | |||||
| 38 | =head2 load( $file ) | ||||
| 39 | |||||
| 40 | Attempts to load C<$file> as a Perl file. | ||||
| 41 | |||||
| 42 | =cut | ||||
| 43 | |||||
| 44 | sub load { | ||||
| 45 | my $class = shift; | ||||
| 46 | my $file = shift; | ||||
| 47 | |||||
| 48 | my( $exception, $content ); | ||||
| 49 | { | ||||
| 50 | local $@; | ||||
| 51 | $content = do $file; | ||||
| 52 | $exception = $@; | ||||
| 53 | } | ||||
| 54 | die $exception if $exception; | ||||
| 55 | |||||
| 56 | return $content; | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | =head1 AUTHOR | ||||
| 60 | |||||
| 61 | Brian Cassidy E<lt>bricas@cpan.orgE<gt> | ||||
| 62 | |||||
| 63 | =head1 COPYRIGHT AND LICENSE | ||||
| 64 | |||||
| 65 | Copyright 2006-2010 by Brian Cassidy | ||||
| 66 | |||||
| 67 | This library is free software; you can redistribute it and/or modify | ||||
| 68 | it under the same terms as Perl itself. | ||||
| 69 | |||||
| 70 | =head1 SEE ALSO | ||||
| 71 | |||||
| 72 | =over 4 | ||||
| 73 | |||||
| 74 | =item * L<Catalyst> | ||||
| 75 | |||||
| 76 | =item * L<Config::Any> | ||||
| 77 | |||||
| 78 | =back | ||||
| 79 | |||||
| 80 | =cut | ||||
| 81 | |||||
| 82 | 1 | 7µs | 1; |