| 1 | package PPI::Statement::When; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | =pod | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||
| 7 | PPI::Statement::When - A when statement | ||||||||||||||||||||||||||||||||||
| 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 | =cut | ||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||
| 42 | 63 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 43 | 63 | ▶ | use PPI::Statement (); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||
| 45 | 63 | our $VERSION = '1.260'; # VERSION | |||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||
| 47 | 63 | our @ISA = "PPI::Statement"; | |||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||
| 49 | # Lexer clues | ||||||||||||||||||||||||||||||||||
| 50 | sub __LEXER__normal() { '' } | ||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||
| 52 | sub _complete { | ||||||||||||||||||||||||||||||||||
| 53 | 0 | ▶ | my $child = $_[0]->schild(-1); | ||||||||||||||||||||||||||||||||
|
Subroutine
_complete: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 54 | return !! ( | ||||||||||||||||||||||||||||||||||
| 55 | 0 | ▶ | defined $child | ||||||||||||||||||||||||||||||||
|
Condition0%0/6
defined $child && $child->isa('PPI::Structure::Block') && $child->complete
defined $child and $child->isa("PPI::Structure::Block")
MC/DC0%0/3
defined $child && $child->isa('PPI::Structure::Block') && $child->complete
defined $child
$child->isa("PPI::Structure::Block")
$child->complete
Truth table0%0/4
A and B && C
A= defined $childB= $child->isa("PPI::Structure::Block")C= $child->complete
| |||||||||||||||||||||||||||||||||||
| 56 | and | ||||||||||||||||||||||||||||||||||
| 57 | $child->isa('PPI::Structure::Block') | ||||||||||||||||||||||||||||||||||
| 58 | and | ||||||||||||||||||||||||||||||||||
| 59 | $child->complete | ||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||
| 67 | ##################################################################### | ||||||||||||||||||||||||||||||||||
| 68 | # PPI::Node Methods | ||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | sub scope() { | ||||||||||||||||||||||||||||||||||
| 71 | 1; | ||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||
| 74 | 63 | 1; | |||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||
| 76 | =pod | ||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | =head1 TO DO | ||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | - Write unit tests for this package | ||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||
| 84 | See the L<support section|PPI/SUPPORT> in the main module. | ||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||
| 86 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||
| 88 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||
| 90 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||
| 92 | Copyright 2001 - 2011 Adam Kennedy. | ||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||
| 94 | This program is free software; you can redistribute | ||||||||||||||||||||||||||||||||||
| 95 | it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||
| 97 | The full text of the license can be found in the | ||||||||||||||||||||||||||||||||||
| 98 | LICENSE file included with this module. | ||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||
| 100 | =cut | ||||||||||||||||||||||||||||||||||