| 1 | package Spellunker::Pod; | ||||||||||
| 2 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use Spellunker; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | ▶ | use Spellunker::Pod::Parser; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 9 | 4 | my $class = shift; | |||||||||
| 10 | 4 | bless {spellunker => Spellunker->new()}, $class; | |||||||||
| 11 | } | ||||||||||
| 12 | |||||||||||
| 13 | 3 | ▶ | sub add_stopwords { | ||||||||
|
Subroutine
add_stopwords: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 14 | 3 | my $self = shift; | |||||||||
| 15 | 3 | $self->{spellunker}->add_stopwords(@_); | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | 1 | ▶ | sub load_dictionary { | ||||||||
|
Subroutine
load_dictionary: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 19 | 1 | my $self = shift; | |||||||||
| 20 | 1 | $self->{spellunker}->load_dictionary(@_); | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 10 | ▶ | sub _check_parser { | ||||||||
|
Subroutine
_check_parser: called CC=4 SCAR=13.9
| |||||||||||
| 24 | 10 | my ($self, $parser) = @_; | |||||||||
| 25 | |||||||||||
| 26 | # '=for stopwords' | ||||||||||
| 27 | 10 | for my $stopwords (@{$parser->stopwords}) { | |||||||||
| 28 | 2 | $self->add_stopwords(split /\s+/, $stopwords); | |||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | 10 | my $lines = $parser->lines; | |||||||||
| 32 | 10 | my $line = 0; | |||||||||
| 33 | 10 | my @rv; | |||||||||
| 34 | 10 | for my $line ( @$lines ) { | |||||||||
| 35 | 108 | my $text = $line->[1]; | |||||||||
| 36 | 108 | my @err = $self->{spellunker}->check_line($text); | |||||||||
| 37 | 108 | ▶ | if (@err) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 38 | 3 | push @rv, [$line->[0], $line->[1], \@err]; | |||||||||
| 39 | } | ||||||||||
| 40 | } | ||||||||||
| 41 | 10 | return @rv; | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 10 | ▶ | sub check_file { | ||||||||
|
Subroutine
check_file: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 45 | 10 | my ($self, $filename) = @_; | |||||||||
| 46 | |||||||||||
| 47 | 10 | my $parser = Spellunker::Pod::Parser->new(); | |||||||||
| 48 | 10 | $parser->parse_file($filename); | |||||||||
| 49 | 10 | $self->_check_parser($parser); | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 0 | ▶ | sub check_text { | ||||||||
|
Subroutine
check_text: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 53 | 0 | my ($self, $text) = @_; | |||||||||
| 54 | |||||||||||
| 55 | 0 | my $parser = Spellunker::Pod::Parser->new(); | |||||||||
| 56 | 0 | $parser->parse_string_document($text); | |||||||||
| 57 | 0 | $self->_check_parser($parser); | |||||||||
| 58 | } | ||||||||||
| 59 | |||||||||||
| 60 | 3 | 1; | |||||||||
| 61 | |||||||||||