File Coverage

blib/lib/Lingua/PTD/XzDmp.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Lingua::PTD::XzDmp;
2             $Lingua::PTD::XzDmp::VERSION = '1.15';
3 1     1   6 use warnings;
  1         1  
  1         28  
4 1     1   6 use strict;
  1         1  
  1         22  
5              
6 1     1   5 use parent 'Lingua::PTD';
  1         2  
  1         6  
7              
8 1     1   862 use IO::Compress::Xz 2.066 qw(xz $XzError);
  0            
  0            
9             use IO::Uncompress::UnXz 2.066 qw(unxz $UnXzError);
10              
11             =encoding UTF-8
12              
13             =head1 NAME
14              
15             Lingua::PTD::XzDmp - Sub-module to handle PTD xz files in Dumper Format
16              
17             =head1 SYNOPSIS
18              
19             use Lingua::PTD;
20              
21             $ptd = Lingua::PTD->new( "file.dmp.xz" );
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) 2010-2014 by Alberto Manuel Brandão Simões
38              
39             =cut
40              
41             sub new {
42             my ($class, $filename) = @_;
43             my $self;
44             unxz $filename => \$self or die "Failed to unxz: $UnXzError.";
45             {
46             no strict;
47             $self = eval $self;
48             die $@ if $@;
49             }
50             bless $self => $class #amen
51             }
52              
53             sub _save {
54             my ($self, $filename) = @_;
55              
56             my $z = new IO::Compress::Xz $filename, encode => 'utf8' or return 0;
57             select $z;
58             $self->dump;
59             $z->close;
60              
61             return 1;
62             }
63              
64             "This isn't right. This isn't even wrong.";
65             __END__