| 1 | package Test::SpellCheck::Plugin::PerlPOD; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use 5.026; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use Pod::Simple::Words; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 2 | ▶ | use experimental qw( signatures ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 2 | ▶ | use Ref::Util qw( is_plain_arrayref ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 2 | ▶ | use PPI::Document; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 2 | ▶ | use PPIx::DocumentName 1.00 -api => 1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | # ABSTRACT: Test::SpellCheck plugin for checking spelling in POD | ||||||||||
| 13 | 2 | our $VERSION = '0.02'; # VERSION | |||||||||
| 14 | |||||||||||
| 15 | |||||||||||
| 16 | 11 | ▶ | sub new ($class, %args) | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 17 | { | ||||||||||
| 18 | 11 | my $skip_sections; | |||||||||
| 19 | |||||||||||
| 20 | 11 | ▶ | if(defined $args{skip_sections}) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | { | ||||||||||
| 22 | 5 | ▶ | $skip_sections = is_plain_arrayref $args{skip_sections} ? [$args{skip_sections}->@*] : [$args{skip_sections}]; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | } | ||||||||||
| 24 | else | ||||||||||
| 25 | { | ||||||||||
| 26 | 6 | $skip_sections = ['contributors', 'author', 'copyright and license']; | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 11 | bless { | |||||||||
| 30 | skip_sections => $skip_sections, | ||||||||||
| 31 | }, $class; | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | 9 | ▶ | sub stream ($self, $filename, $splitter, $callback) | ||||||||
|
Subroutine
stream: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 35 | { | ||||||||||
| 36 | { | ||||||||||
| 37 | 9 | my $ppi = PPI::Document->new($filename); | |||||||||
| 38 | 9 | my $result = PPIx::DocumentName->extract($ppi); | |||||||||
| 39 | 9 | ▶ | if(defined $result) | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | { | ||||||||||
| 41 | 1 | $callback->('name', $filename, $result->node->location->[0], $result->name); | |||||||||
| 42 | } | ||||||||||
| 43 | } | ||||||||||
| 44 | |||||||||||
| 45 | { | ||||||||||
| 46 | 9 | my $parser = Pod::Simple::Words->new; | |||||||||
| 47 | 9 | $parser->callback($callback); | |||||||||
| 48 | 9 | $parser->splitter($splitter); | |||||||||
| 49 | 9 | $parser->skip_sections($self->{skip_sections}->@*); | |||||||||
| 50 | 9 | $parser->parse_file($filename); | |||||||||
| 51 | } | ||||||||||
| 52 | 9 | return $self; | |||||||||
| 53 | } | ||||||||||
| 54 | |||||||||||
| 55 | 2 | 1; | |||||||||
| 56 | |||||||||||
| 57 | __END__ | ||||||||||