PTD/TSV.pm untested

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 4 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 33 SCAR 17.9
CC
2
Cov
0%
_save
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 6.0
1 package Lingua::PTD::TSV;
2 $Lingua::PTD::TSV::VERSION = '1.16';
3 use warnings;
4 use strict;
5  
6 use parent 'Lingua::PTD';
7  
8 =encoding UTF-8
9  
10 =head1 NAME
11  
12 Lingua::PTD::TSV - Sub-module to export PTD to TSV
13  
14 =head1 SYNOPSIS
15  
16 use Lingua::PTD;
17  
18 my $ptd = Lingua::PTD->new( $file );
19 $ptd->saveAs("tsv", $dest, $options);
20  
21 =head1 DESCRIPTION
22  
23 Check L<<Lingua::PTD>> for complete reference.
24  
25 =head1 SEE ALSO
26  
27 NATools(3), perl(1)
28  
29 =head1 AUTHOR
30  
31 Alberto Manuel Brandão Simões, E<lt>ambs@cpan.orgE<gt>
32  
33 =head1 COPYRIGHT AND LICENSE
34  
35 Copyright (C) 2010-2014 by Alberto Manuel Brandão Simões
36  
37 =cut
38  
39 sub _save {
40 my ($ptd, $filename, $my_opts) = @_;
41 my $min = $my_opts->{m} //= 0.5;
42  
43 open OUT, ">:utf8", $filename or return 0;
44 select OUT;
45 $ptd->downtr( sub {
46 my ($w, $c, %t) = @_;
47 foreach (keys %t) {
48 printf("%s\t%s\t%s %.0f%s\n",$w,$_,$_,$t{$_}*100,'%') if ($t{$_} > $min);
49 }
50 });
51 close OUT;
52  
53 return 1;
54 }
55  
56 "This is Sparta!";
57 __END__