PTD/BzDmp.pm

filter: Statementstmt 58.8% 20 / 34 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 6 / 8 Podpod 100% 1 / 1 totaltotal 55.1% 27 / 49 SCAR 17.9
CC
4
Cov
50%
new
7.4
_save
6.0
BEGIN
1.0
CRAP 6.0
« PTD/TSV.pm ↑ Summary PTD/Dumper.pm »
1 package Lingua::PTD::BzDmp;
2 1 $Lingua::PTD::BzDmp::VERSION = '1.16';
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use parent 'Lingua::PTD';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use IO::Compress::Bzip2 2.066 qw(bzip2 $Bzip2Error);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use IO::Uncompress::Bunzip2 2.066 qw(bunzip2 $Bunzip2Error);
Subroutine BEGIN: called CC=1 SCAR=0.0
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<<Lingua::PTD>> 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, E<lt>ambs@cpan.orgE<gt>
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 ▶ my ($class, $filename) = @_;
Subroutine new: not called CC=3 SCAR=20.0
Pod documented
43 0 my $self;
44 0 ▶ bunzip2 $filename => \$self or die "Failed to bunzip: $Bunzip2Error.";
Branch: 1 branch
BranchTrueFalseTotal
bunzip2($filename, \$self) or die "Failed to bunzip: $Lingua::PTD::BzDmp::Bunzip2Error." 0 0 0
45 {
46 1 ▶ no strict;
Subroutine BEGIN: called CC=1 SCAR=0.2
47 0 $self = eval $self;
48 0 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
49 }
50 0 bless $self => $class #amen
51 }
52  
53 sub _save {
54 0 ▶ my ($self, $filename) = @_;
Subroutine _save: not called CC=2 SCAR=17.9
55  
56 0 ▶ my $z = new IO::Compress::Bzip2 $filename, encode => 'utf8' or return 0;
Branch: 1 branch
BranchTrueFalseTotal
my $z = "IO::Compress::Bzip2"->new($filename, "encode", "utf8") or return 0 0 0 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 1 "This isn't right. This isn't even wrong.";
66 __END__
« PTD/TSV.pm ↑ Summary PTD/Dumper.pm »