File Coverage

blib/lib/Lingua/PTD/BzDmp.pm
Criterion Covered Total %
statement 18 32 56.2
branch 0 6 0.0
condition n/a
subroutine 6 8 75.0
pod 1 1 100.0
total 25 47 53.1


line stmt bran cond sub pod time code
1             package Lingua::PTD::BzDmp;
2             $Lingua::PTD::BzDmp::VERSION = '1.16';
3 1     1   9 use warnings;
  1         2  
  1         77  
4 1     1   10 use strict;
  1         1  
  1         26  
5              
6 1     1   4 use parent 'Lingua::PTD';
  1         1  
  1         4  
7              
8 1     1   330 use IO::Compress::Bzip2 2.066 qw(bzip2 $Bzip2Error);
  1         21340  
  1         90  
9 1     1   325 use IO::Uncompress::Bunzip2 2.066 qw(bunzip2 $Bunzip2Error);
  1         8504  
  1         130  
10              
11             =encoding UTF-8
12              
13             =head1 NAME
14              
15             Lingua::PTD::BzDmp - Sub-module to handle PTD bzipped files in Dumper Format
16              
17             =head1 SYNOPSIS
18              
19             use Lingua::PTD;
20              
21             $ptd = Lingua::PTD->new( "file.dmp.bz2" );
22              
23             =head1 DESCRIPTION
24              
25             Check L<> for complete reference.
26              
27             =head1 SEE ALSO
28              
29             NATools(3), perl(1)
30              
31             =head1 AUTHOR
32              
33             Alberto Manuel Brandão Simões, Eambs@cpan.orgE
34              
35             =head1 COPYRIGHT AND LICENSE
36              
37             Copyright (C) 2011-2014 by Alberto Manuel Brandão Simões
38              
39             =cut
40              
41             sub new {
42 0     0 1   my ($class, $filename) = @_;
43 0           my $self;
44 0 0         bunzip2 $filename => \$self or die "Failed to bunzip: $Bunzip2Error.";
45             {
46 1     1   7 no strict;
  1         1  
  1         100  
  0            
47 0           $self = eval $self;
48 0 0         die $@ if $@;
49             }
50 0           bless $self => $class #amen
51             }
52              
53             sub _save {
54 0     0     my ($self, $filename) = @_;
55              
56 0 0         my $z = new IO::Compress::Bzip2 $filename, encode => 'utf8' or return 0;
57 0           binmode $z, ":utf8";
58 0           select $z;
59 0           $self->dump;
60 0           $z->close;
61              
62 0           return 1;
63             }
64              
65             "This isn't right. This isn't even wrong.";
66             __END__