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: Tue Nov 13 10:10:20 2018 |
9
|
|
|
|
|
|
|
# Update Count : 80 |
10
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
################ Common stuff ################ |
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
870
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
15
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
16
|
1
|
|
|
1
|
|
4
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
17
|
1
|
|
|
1
|
|
5
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
package Data::iRealPro::Output; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
29
|
use Data::iRealPro::Input; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
22
|
1
|
|
|
1
|
|
6
|
use Encode qw ( decode_utf8 ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
461
|
|
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
|
|
|
|
|
|
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 ( $options->{split} |
50
|
|
|
|
|
|
|
|| $opts->{output} =~ /\.html$/i ) { |
51
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::HTML; |
52
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::HTML::; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
elsif ( !$self->{_backend} ) { |
55
|
0
|
|
|
|
|
|
require Data::iRealPro::Output::Imager; |
56
|
0
|
|
|
|
|
|
$self->{_backend} = Data::iRealPro::Output::Imager::; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
for ( @{ $self->{_backend}->options } ) { |
|
0
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
|
$opts->{$_} = $options->{$_} if exists $options->{$_}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
$self->{options} = $opts; |
64
|
0
|
|
|
|
|
|
return $self; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub processfiles { |
68
|
0
|
|
|
0
|
0
|
|
my ( $self, @files ) = @_; |
69
|
0
|
|
|
|
|
|
my $opts = $self->{options}; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
my $all = Data::iRealPro::Input->new($opts)->parsefiles(@files); |
72
|
0
|
|
|
|
|
|
$self->{_backend}->new($opts)->process( $all, $opts ); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
1; |