| 1 | package PPI::Statement::Given; | ||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||
| 3 | =pod | ||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||
| 7 | PPI::Statement::Given - A given-when statement | ||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||
| 9 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||
| 11 | given ( foo ) { | ||||||||||||||||||||||||||||||||||
| 12 | say $_; | ||||||||||||||||||||||||||||||||||
| 13 | } | ||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||
| 15 | =head1 INHERITANCE | ||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||
| 17 | PPI::Statement::Given | ||||||||||||||||||||||||||||||||||
| 18 | isa PPI::Statement | ||||||||||||||||||||||||||||||||||
| 19 | isa PPI::Node | ||||||||||||||||||||||||||||||||||
| 20 | isa PPI::Element | ||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||
| 24 | C<PPI::Statement::Given> objects are used to describe switch statements, as | ||||||||||||||||||||||||||||||||||
| 25 | described in L<perlsyn>. | ||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||
| 27 | =head1 METHODS | ||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||
| 29 | C<PPI::Statement::Given> has no methods beyond those provided by the | ||||||||||||||||||||||||||||||||||
| 30 | standard L<PPI::Structure>, L<PPI::Node> and L<PPI::Element> methods. | ||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||
| 32 | =cut | ||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||
| 34 | 62 | ▶ | use strict; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 35 | 62 | ▶ | use PPI::Statement (); | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||
| 37 | 62 | ▶ | use vars qw{$VERSION @ISA}; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 38 | BEGIN { | ||||||||||||||||||||||||||||||||||
| 39 | 62 | ▶ | $VERSION = '1.236'; | ||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||
| 40 | 62 | @ISA = 'PPI::Statement'; | |||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||
| 43 | # Lexer clues | ||||||||||||||||||||||||||||||||||
| 44 | sub __LEXER__normal() { '' } | ||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||
| 46 | sub _complete { | ||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $child = $_[0]->schild(-1); | ||||||||||||||||||||||||||||||||
|
Subroutine
_complete: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||
| 48 | return !! ( | ||||||||||||||||||||||||||||||||||
| 49 | 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
| |||||||||||||||||||||||||||||||||||
| 50 | and | ||||||||||||||||||||||||||||||||||
| 51 | $child->isa('PPI::Structure::Block') | ||||||||||||||||||||||||||||||||||
| 52 | and | ||||||||||||||||||||||||||||||||||
| 53 | $child->complete | ||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||
| 61 | ##################################################################### | ||||||||||||||||||||||||||||||||||
| 62 | # PPI::Node Methods | ||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||
| 64 | sub scope() { 1 } | ||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||
| 66 | 62 | 1; | |||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||
| 68 | =pod | ||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||
| 70 | =head1 TO DO | ||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||
| 72 | - Write unit tests for this package | ||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||
| 74 | =head1 SUPPORT | ||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||
| 76 | See the L<support section|PPI/SUPPORT> in the main module. | ||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||
| 78 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||
| 80 | Adam Kennedy E<lt>adamk@cpan.orgE<gt> | ||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||
| 82 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||
| 84 | Copyright 2001 - 2011 Adam Kennedy. | ||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||
| 86 | This program is free software; you can redistribute | ||||||||||||||||||||||||||||||||||
| 87 | it and/or modify it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||
| 89 | The full text of the license can be found in the | ||||||||||||||||||||||||||||||||||
| 90 | LICENSE file included with this module. | ||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||
| 92 | =cut | ||||||||||||||||||||||||||||||||||