| Filename | /Users/timbo/perl5/perlbrew/perls/perl-5.18.2/lib/site_perl/5.18.2/PPI/Statement/When.pm |
| Statements | Executed 9 statements in 183µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 12µs | 24µs | PPI::Statement::When::BEGIN@44 |
| 1 | 1 | 1 | 9µs | 9µs | PPI::Statement::When::BEGIN@48 |
| 1 | 1 | 1 | 7µs | 35µs | PPI::Statement::When::BEGIN@47 |
| 1 | 1 | 1 | 3µs | 3µs | PPI::Statement::When::BEGIN@45 |
| 0 | 0 | 0 | 0s | 0s | PPI::Statement::When::__LEXER__normal |
| 0 | 0 | 0 | 0s | 0s | PPI::Statement::When::_complete |
| 0 | 0 | 0 | 0s | 0s | PPI::Statement::When::scope |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package PPI::Statement::When; | ||||
| 2 | |||||
| 3 | =pod | ||||
| 4 | |||||
| 5 | =head1 NAME | ||||
| 6 | |||||
| 7 | PPI::Statement::When - Describes all compound statements | ||||
| 8 | |||||
| 9 | =head1 SYNOPSIS | ||||
| 10 | |||||
| 11 | foreach ( qw/ foo bar baz / ) { | ||||
| 12 | when ( m/b/ ) { | ||||
| 13 | boing($_); | ||||
| 14 | } | ||||
| 15 | when ( m/f/ ) { | ||||
| 16 | boom($_); | ||||
| 17 | } | ||||
| 18 | default { | ||||
| 19 | tchak($_); | ||||
| 20 | } | ||||
| 21 | } | ||||
| 22 | |||||
| 23 | =head1 INHERITANCE | ||||
| 24 | |||||
| 25 | PPI::Statement::When | ||||
| 26 | isa PPI::Statement | ||||
| 27 | isa PPI::Node | ||||
| 28 | isa PPI::Element | ||||
| 29 | |||||
| 30 | =head1 DESCRIPTION | ||||
| 31 | |||||
| 32 | C<PPI::Statement::When> objects are used to describe when and default | ||||
| 33 | statements, as described in L<perlsyn>. | ||||
| 34 | |||||
| 35 | =head1 METHODS | ||||
| 36 | |||||
| 37 | C<PPI::Structure::When> has no methods beyond those provided by the | ||||
| 38 | standard L<PPI::Structure>, L<PPI::Node> and L<PPI::Element> methods. | ||||
| 39 | |||||
| 40 | Got any ideas for methods? Submit a report to rt.cpan.org! | ||||
| 41 | |||||
| 42 | =cut | ||||
| 43 | |||||
| 44 | 2 | 37µs | 2 | 36µs | # spent 24µs (12+12) within PPI::Statement::When::BEGIN@44 which was called:
# once (12µs+12µs) by PPI::Statement::BEGIN@176 at line 44 # spent 24µs making 1 call to PPI::Statement::When::BEGIN@44
# spent 12µs making 1 call to strict::import |
| 45 | 2 | 19µs | 1 | 3µs | # spent 3µs within PPI::Statement::When::BEGIN@45 which was called:
# once (3µs+0s) by PPI::Statement::BEGIN@176 at line 45 # spent 3µs making 1 call to PPI::Statement::When::BEGIN@45 |
| 46 | |||||
| 47 | 2 | 31µs | 2 | 64µs | # spent 35µs (7+28) within PPI::Statement::When::BEGIN@47 which was called:
# once (7µs+28µs) by PPI::Statement::BEGIN@176 at line 47 # spent 35µs making 1 call to PPI::Statement::When::BEGIN@47
# spent 28µs making 1 call to vars::import |
| 48 | # spent 9µs within PPI::Statement::When::BEGIN@48 which was called:
# once (9µs+0s) by PPI::Statement::BEGIN@176 at line 51 | ||||
| 49 | 1 | 400ns | $VERSION = '1.215'; | ||
| 50 | 1 | 9µs | @ISA = 'PPI::Statement'; | ||
| 51 | 1 | 84µs | 1 | 9µs | } # spent 9µs making 1 call to PPI::Statement::When::BEGIN@48 |
| 52 | |||||
| 53 | # Lexer clues | ||||
| 54 | sub __LEXER__normal { '' } | ||||
| 55 | |||||
| 56 | sub _complete { | ||||
| 57 | my $child = $_[0]->schild(-1); | ||||
| 58 | return !! ( | ||||
| 59 | defined $child | ||||
| 60 | and | ||||
| 61 | $child->isa('PPI::Structure::Block') | ||||
| 62 | and | ||||
| 63 | $child->complete | ||||
| 64 | ); | ||||
| 65 | } | ||||
| 66 | |||||
| - - | |||||
| 71 | ##################################################################### | ||||
| 72 | # PPI::Node Methods | ||||
| 73 | |||||
| 74 | sub scope { | ||||
| 75 | 1; | ||||
| 76 | } | ||||
| 77 | |||||
| 78 | 1 | 2µs | 1; | ||
| 79 | |||||
| 80 | =pod | ||||
| 81 | |||||
| 82 | =head1 TO DO | ||||
| 83 | |||||
| 84 | - Write unit tests for this package | ||||
| 85 | |||||
| 86 | =head1 SUPPORT | ||||
| 87 | |||||
| 88 | See the L<support section|PPI/SUPPORT> in the main module. | ||||
| 89 | |||||
| 90 | =head1 AUTHOR | ||||
| 91 | |||||
| 92 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||
| 93 | |||||
| 94 | =head1 COPYRIGHT | ||||
| 95 | |||||
| 96 | Copyright 2001 - 2011 Adam Kennedy. | ||||
| 97 | |||||
| 98 | This program is free software; you can redistribute | ||||
| 99 | it and/or modify it under the same terms as Perl itself. | ||||
| 100 | |||||
| 101 | The full text of the license can be found in the | ||||
| 102 | LICENSE file included with this module. | ||||
| 103 | |||||
| 104 | =cut |