File Coverage

blib/lib/Perldoc/Reader.pm
Criterion Covered Total %
statement 16 29 55.1
branch 1 4 25.0
condition n/a
subroutine 5 8 62.5
pod 0 1 0.0
total 22 42 52.3


line stmt bran cond sub pod time code
1             package Perldoc::Reader;
2 1     1   6 use Perldoc::Base -Base;
  1         2  
  1         7  
3 1     1   723  
  1     1   2  
  1         26  
  1         5  
  1         2  
  1         298  
4             field 'string';
5             field 'stringref';
6             field 'filehandle';
7             field 'filepath';
8              
9 1     1 0 10 sub all {
10 1         5 for my $source (qw(string stringref filepath filehandle)) {
11 1 50       7 if (defined $self->{$source}) {
12 1         5 my $method = "_all_$source";
13 1         8 return $self->$method();
14             }
15             }
16 0         0 die "No input to read";
17             }
18              
19 1     1   2 sub _all_string {
20 1         25 return $self->string;
21             }
22              
23 0     0     sub _all_stringref {
24 0           return ${$self->stringref};
  0            
25             }
26              
27 0     0     sub _all_filepath {
28 0           my $filepath = $self->filepath;
29 0 0         open my $input, $filepath
30             or die "Can't open '$filepath' for input:\n$!";
31 0           local $/;
32             return <$input>
33 0           }
34              
35 0     0     sub _all_filehandle {
36 0           my $filehandle = $self->filehandle;
37 0           local $/;
38 0           return <$filehandle>;
39             }
40              
41             =head1 NAME
42              
43             Perldoc::Reader - Reader Class for Perldoc Parsers
44              
45             =head1 SYNOPSIS
46              
47             package Perldoc::Reader;
48              
49             =head1 DESCRIPTION
50              
51             Uniform reading interface.
52              
53             XXX - Should be a mixin for Parsers.
54              
55             =head1 AUTHOR
56              
57             Ingy döt Net
58              
59             Audrey wrote the original code for this parser.
60              
61             =head1 COPYRIGHT
62              
63             Copyright (c) 2006. Ingy döt Net. All rights reserved.
64              
65             This program is free software; you can redistribute it and/or modify it
66             under the same terms as Perl itself.
67              
68             See L
69              
70             =cut