UnRTF.pm

filter: Statementstmt 75.0% 12 / 16 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 2 totaltotal 70.8% 17 / 24 CC 2 SCAR 5.8
CC
2
Cov
72%
unrtf
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
↑ Summary UnRTF/Test.pm »
1 package UnRTF;
2 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 =head1 NAME
6  
7 UnRTF - A Perl wrapper around unrtf tool
8  
9 =head1 DESCRIPTION
10  
11 UnRTF is a simple wrapper around unrtf command line tool, unrtf converts RTF
12 files to text and write it to the STDOUT.
13  
14 See: L<http://www.gnu.org/software/unrtf>.
15  
16 =head1 SYNOPSIS
17  
18 use UnRTF;
19 my $unrtf = UnRTF->new(file => "/tmp/file.rtf");
20 my $text = $unrtf->convert(format => 'text');
21  
22 =head1 COPYRIGHT
23  
24 Copyright (C) 2013 Joenio Costa
25  
26 =cut
27  
28 1 has file => (is => 'rw', isa => 'Str', required => 1);
29  
30 sub unrtf {
31 2 ▶ open STDERR, '>', '/dev/null';
Subroutine unrtf: called CC=2 SCAR=10.9
Pod undocumented
32 2 ▶ open(UNRTF, "unrtf @_ |") or die $!;
Branch: 1 branch
BranchTrueFalseTotal
open UNRTF, "unrtf @_ |" or die $! 2 0 2
33 0 local $/ = undef;
34 0 my $OUTPUT = <UNRTF>;
35 0 close UNRTF;
36 0 $OUTPUT;
37 }
38  
39 sub convert {
40 2 ▶ my ($self, %args) = @_;
Subroutine convert: called CC=1 SCAR=0.0
Pod undocumented
41 2 unrtf("--$args{format}", $self->file);
42 }
43  
44 1 1;
↑ Summary UnRTF/Test.pm »