| 1 | package Lingua::PTD::XzDmp; | ||
| 2 | $Lingua::PTD::XzDmp::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::Xz 2.066 qw(xz $XzError); |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 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<<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) 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__ | ||