File Coverage

blib/lib/Pod/Spelling/CommonMistakes.pm
Criterion Covered Total %
statement 25 25 100.0
branch 1 2 50.0
condition n/a
subroutine 7 7 100.0
pod n/a
total 33 34 97.0


line stmt bran cond sub pod time code
1             #
2             # This file is part of Pod-Spell-CommonMistakes
3             #
4             # This software is copyright (c) 2014 by Apocalypse.
5             #
6             # This is free software; you can redistribute it and/or modify it under
7             # the same terms as the Perl 5 programming language system itself.
8             #
9 1     1   6914 use strict; use warnings;
  1     1   3  
  1         31  
  1         4  
  1         0  
  1         71  
10             package Pod::Spelling::CommonMistakes;
11             $Pod::Spelling::CommonMistakes::VERSION = '1.001';
12             our $AUTHORITY = 'cpan:APOCAL';
13              
14             # ABSTRACT: Adaptor for Pod::Spelling to use CommonMistakes as a checker
15              
16 1     1   6 use parent 'Pod::Spelling'; # Thanks :)
  1         2  
  1         8  
17              
18 1     1   545 use Pod::Spell::CommonMistakes::WordList qw( _check_common _check_case );
  1         2  
  1         106  
19              
20             # We override our base...
21 1     1   6 no warnings 'redefine';
  1         1  
  1         152  
22              
23             sub _init {
24 2 50   2   879 shift if not ref $_[0];
25 2         3 my $self = shift;
26              
27             # Nothing magical to do :)
28              
29 2         5 return $self;
30             }
31              
32             # Accepts one or more lines of text, returns a list mispelt words.
33             sub _spell_check_callback {
34 20     20   9458 my $self = shift;
35 20         56 my @lines = grep { length $_ } split /\s+/, join( ' ', @_ );
  87         101  
36 20         50 my $err = _check_common( \@lines );
37 20         34 $err = { %$err, %{ _check_case( \@lines ) } };
  20         40  
38              
39 20         64 return keys %$err;
40             }
41              
42             1;
43              
44             __END__