File Coverage

blib/lib/HTML/HTMLDoc/PDF.pm
Criterion Covered Total %
statement 14 33 42.4
branch 0 4 0.0
condition n/a
subroutine 5 8 62.5
pod 2 3 66.6
total 21 48 43.7


line stmt bran cond sub pod time code
1             package HTML::HTMLDoc::PDF;
2              
3 1     1   18 use 5.006;
  1         4  
4 1     1   5 use strict;
  1         3  
  1         18  
5 1     1   5 use warnings;
  1         2  
  1         22  
6 1     1   4 use IO::File;
  1         2  
  1         150  
7 1     1   7 use vars qw(@ISA $VERSION);
  1         2  
  1         245  
8              
9             @ISA = qw();
10             $VERSION = '0.14';
11              
12             ###############
13             # create a new Object
14             # param:
15             # return: object:HTML::HTMLDOC
16             ###############
17             sub new {
18 0     0 0   my $package = shift;
19 0           my $contentref = shift;
20            
21 0 0         return undef if (ref($contentref) ne 'SCALAR');
22              
23 0           my $self = {};
24 0           bless($self, $package);
25              
26 0           $self->{'content'} = $contentref;
27 0           return $self;
28             }
29              
30             ###############
31             # returns the content as string
32             # param:
33             # return: conent:STRING
34             ###############
35             sub to_string {
36 0     0 1   my $self = shift;
37 0           return ${$self->{'content'}};
  0            
38             }
39              
40             ###############
41             # writes the output to a file
42             # specified by filename
43             # param: filename|STRING
44             # return:
45             ###############
46             sub to_file {
47 0     0 1   my $self = shift;
48 0           my $filename = shift;
49            
50 0           my $file = new IO::File($filename, "w");
51 0 0         if (!$file) {
52 0           return 0;
53             }
54 0           print $file ${$self->{'content'}};
  0            
55 0           $file->close();
56 0           return 1;
57             }
58              
59             1;
60             __END__