line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#! perl |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Data::iRealPro::Output -- pass data to backends |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# Author : Johan Vromans |
6
|
|
|
|
|
|
|
# Created On : Tue Sep 6 16:09:10 2016 |
7
|
|
|
|
|
|
|
# Last Modified By: Johan Vromans |
8
|
|
|
|
|
|
|
# Last Modified On: Mon Jan 7 09:30:08 2019 |
9
|
|
|
|
|
|
|
# Update Count : 81 |
10
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
################ Common stuff ################ |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
927
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
16
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
43
|
|
17
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
14
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Data::iRealPro::Output; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
43
|
use Data::iRealPro::Input; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
22
|
1
|
|
|
1
|
|
4
|
use Encode qw ( decode_utf8 ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
496
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub new { |
25
|
0
|
|
|
0
|
0
|
|
my ( $pkg, $options ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
my $self = bless( { variant => "irealpro" }, $pkg ); |
28
|
0
|
|
|
|
|
|
my $opts; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
0
|
|
|
|
$opts->{output} = $options->{output} || ""; |
31
|
0
|
|
0
|
|
|
|
$opts->{transpose} = $options->{transpose} // 0; |
32
|
0
|
0
|
0
|
|
|
|
if ( $options->{generate} ) { |
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
$self->{_backend} = "Data::iRealPro::Output::" . ucfirst($options->{generate}); |
34
|
0
|
|
|
|
|
|
eval "require $self->{_backend}"; |
35
|
0
|
0
|
|
|
|
|
die($@) if $@; |
36
|
0
|
|
0
|
|
|
|
$opts->{output} ||= "-"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
elsif ( $options->{list} |
40
|
|
|
|
|
|
|
|| $opts->{output} =~ /\.txt$/i ) { |
41
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::Text; |
42
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::Text::; |
43
|
0
|
|
0
|
|
|
|
$opts->{output} ||= "-"; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
elsif ( $opts->{output} =~ /\.jso?n$/i ) { |
46
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::JSON; |
47
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::JSON::; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
elsif ( $opts->{output} =~ /\.mma$/i ) { |
50
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::MMA; |
51
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::MMA::; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
elsif ( $options->{split} |
54
|
|
|
|
|
|
|
|| $opts->{output} =~ /\.html$/i ) { |
55
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::HTML; |
56
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::HTML::; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
elsif ( !$self->{_backend} ) { |
59
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::Imager; |
60
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::Imager::; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
for ( @{ $self->{_backend}->options } ) { |
|
0
|
|
|
|
|
|
|
64
|
0
|
0
|
|
|
|
|
$opts->{$_} = $options->{$_} if exists $options->{$_}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$self->{options} = $opts; |
68
|
0
|
|
|
|
|
|
return $self; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub processfiles { |
72
|
0
|
|
|
0
|
0
|
|
my ( $self, @files ) = @_; |
73
|
0
|
|
|
|
|
|
my $opts = $self->{options}; |
74
|
|
|
|
|
|
|
|
75
|
0
|
|
|
|
|
|
my $all = Data::iRealPro::Input->new($opts)->parsefiles(@files); |
76
|
0
|
|
|
|
|
|
$self->{_backend}->new($opts)->process( $all, $opts ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |