| 1 | package Search::Tools; | ||||||||||||||||||||
| 2 | 41 | ▶ | use 5.008_003; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 41 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 41 | ▶ | use warnings::register; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 41 | ▶ | use Carp; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 41 | ▶ | use Scalar::Util qw( openhandle ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 41 | ▶ | use File::Basename; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 41 | our $VERSION = '1.007'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 41 | ▶ | use XSLoader; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 41 | XSLoader::load( 'Search::Tools', $VERSION ); | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | 41 | our $XS_DEBUG = 0; | |||||||||||||||||||
| 15 | |||||||||||||||||||||
| 16 | 19 | ▶ | sub parser { | ||||||||||||||||||
|
Subroutine
parser: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 17 | 19 | my $class = shift; | |||||||||||||||||||
| 18 | 19 | require Search::Tools::QueryParser; | |||||||||||||||||||
| 19 | 19 | return Search::Tools::QueryParser->new(@_); | |||||||||||||||||||
| 20 | } | ||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | sub regexp { | ||||||||||||||||||
|
Subroutine
regexp: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 23 | 0 | my $class = shift; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 0 | croak("as of version 0.24 you should use parser() instead of regexp()"); | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 11 | ▶ | sub hiliter { | ||||||||||||||||||
|
Subroutine
hiliter: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 29 | 11 | my $class = shift; | |||||||||||||||||||
| 30 | 11 | require Search::Tools::HiLiter; | |||||||||||||||||||
| 31 | 11 | return Search::Tools::HiLiter->new(@_); | |||||||||||||||||||
| 32 | } | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 6 | ▶ | sub snipper { | ||||||||||||||||||
|
Subroutine
snipper: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 35 | 6 | my $class = shift; | |||||||||||||||||||
| 36 | 6 | require Search::Tools::Snipper; | |||||||||||||||||||
| 37 | 6 | return Search::Tools::Snipper->new(@_); | |||||||||||||||||||
| 38 | } | ||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | ▶ | sub transliterate { | ||||||||||||||||||
|
Subroutine
transliterate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 41 | 0 | my $class = shift; | |||||||||||||||||||
| 42 | 0 | require Search::Tools::Transliterate; | |||||||||||||||||||
| 43 | 0 | return Search::Tools::Transliterate->new->convert(@_); | |||||||||||||||||||
| 44 | } | ||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 0 | ▶ | sub spellcheck { | ||||||||||||||||||
|
Subroutine
spellcheck: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 47 | 0 | my $class = shift; | |||||||||||||||||||
| 48 | 0 | require Search::Tools::SpellCheck; | |||||||||||||||||||
| 49 | 0 | return Search::Tools::SpellCheck->new(@_); | |||||||||||||||||||
| 50 | } | ||||||||||||||||||||
| 51 | |||||||||||||||||||||
| 52 | 16 | ▶ | sub slurp { | ||||||||||||||||||
|
Subroutine
slurp: called CC=7 SCAR=23.0
Pod
documented
| |||||||||||||||||||||
| 53 | 16 | my ( $self, $file ) = @_; | |||||||||||||||||||
| 54 | 16 | my ( $buf, $fh ); | |||||||||||||||||||
| 55 | 16 | my ( $name, $path, $suffix ) = fileparse( $file, qr/\.[^.]*/ ); | |||||||||||||||||||
| 56 | 16 | $suffix = lc($suffix); | |||||||||||||||||||
| 57 | 16 | ▶ | if ( $suffix eq '.gz' ) { | ||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||
| 58 | 0 | require IO::Uncompress::Gunzip; | |||||||||||||||||||
| 59 | 0 | $fh = IO::Uncompress::Gunzip->new($file); | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | elsif ( $suffix eq '.bz2' ) { | ||||||||||||||||||||
| 62 | 0 | require IO::Uncompress::Bunzip2; | |||||||||||||||||||
| 63 | 0 | ▶ | $fh = IO::Uncompress::Bunzip2->new($file) | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 64 | or die "bunzip2 failed: $IO::Uncompress::Bunzip2::Bunzip2Error\n"; | ||||||||||||||||||||
| 65 | |||||||||||||||||||||
| 66 | } | ||||||||||||||||||||
| 67 | else { | ||||||||||||||||||||
| 68 | 16 | require IO::File; | |||||||||||||||||||
| 69 | 16 | ▶ | $fh = openhandle($file) || IO::File->new( $file, '<' ); | ||||||||||||||||||
|
Condition33%1/3
&openhandle($file) || 'IO::File'->new($file, '<')
MC/DC0%0/2
&openhandle($file) || 'IO::File'->new($file, '<')
&openhandle($file)
'IO::File'->new($file, '<')
Truth table33%1/3
A || B
A= &openhandle($file)B= 'IO::File'->new($file, '<')
| |||||||||||||||||||||
| 70 | } | ||||||||||||||||||||
| 71 | |||||||||||||||||||||
| 72 | 16 | ▶ | die "Failed to open $file: $!" unless $fh; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | 16 | ▶ | while ( my $ln = $fh->getline ) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 75 | 1918 | $buf .= $ln; | |||||||||||||||||||
| 76 | } | ||||||||||||||||||||
| 77 | |||||||||||||||||||||
| 78 | 16 | return $buf; | |||||||||||||||||||
| 79 | } | ||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | 41 | 1; | |||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | __END__ | ||||||||||||||||||||