| 1 | #!perl | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 8 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 8 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 8 | ▶ | use Pod::Advent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 8 | ▶ | use Getopt::Long; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 8 | ▶ | my $pod = shift @ARGV or die "need pod filename, or - for file on stdin, or + for snippet on stdin"; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 7 | my $css; | |||||||||||||||||||||||||||
| 12 | 7 | my $isadvent = 1; | |||||||||||||||||||||||||||
| 13 | 7 | my $spellcheck = 1; | |||||||||||||||||||||||||||
| 14 | 7 | GetOptions( | |||||||||||||||||||||||||||
| 15 | 'css=s' => \$css, | ||||||||||||||||||||||||||||
| 16 | 'advent!' => \$isadvent, | ||||||||||||||||||||||||||||
| 17 | 'spellcheck!' => \$spellcheck, | ||||||||||||||||||||||||||||
| 18 | ); | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 7 | my $advent = Pod::Advent->new; | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 7 | ▶ | if( !$spellcheck && $advent->spellcheck_enabled ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not $spellcheck and $advent->spellcheck_enabled
MC/DC0%0/2
not $spellcheck and $advent->spellcheck_enabled
not $spellcheck
$advent->spellcheck_enabled
Truth table66%2/3
not(A) and B
A= not $spellcheckB= $advent->spellcheck_enabled
| |||||||||||||||||||||||||||||
| 23 | # user wants the (available) spellcheck turned off | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | # HACK. This should be an accessor to an attribute. | ||||||||||||||||||||||||||||
| 26 | 0 | $Pod::Advent::speller = undef; | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 7 | ▶ | $advent->css_url($css) if $css; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 7 | $Pod::Advent::data{isAdvent} = $isadvent; # HACK. This should be an accessor to an attribute. | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 7 | ▶ | if( $pod eq '-' ){ | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 34 | 1 | $advent->parse_file( \*STDIN ); | |||||||||||||||||||||||||||
| 35 | }elsif( $pod eq '+' ){ | ||||||||||||||||||||||||||||
| 36 | 2 | local $/ = undef; | |||||||||||||||||||||||||||
| 37 | 2 | my $s = "=pod\n\n" . <STDIN> . "\n\n=cut"; | |||||||||||||||||||||||||||
| 38 | 2 | $Pod::Advent::BODY_ONLY = 1; | |||||||||||||||||||||||||||
| 39 | 2 | $advent->parse_string_document( $s ); | |||||||||||||||||||||||||||
| 40 | }else{ | ||||||||||||||||||||||||||||
| 41 | 4 | $advent->parse_file( $pod ); | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 7 | ▶ | if( $advent->num_spelling_errors ){ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 45 | 0 | print STDERR "Possible SPELLING ERRORS:\n"; | |||||||||||||||||||||||||||
| 46 | 0 | my %seen; | |||||||||||||||||||||||||||
| 47 | 0 | foreach my $word ( $advent->spelling_errors ){ | |||||||||||||||||||||||||||
| 48 | 0 | ▶ | print STDERR "\t$word\n" unless $seen{$word}++; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | __END__ | ||||||||||||||||||||||||||||