| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package MMM::Sylk; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6326
|
use 5.006; |
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
38
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
29
|
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
|
1
|
|
|
|
|
6
|
|
|
|
1
|
|
|
|
|
46
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
|
8
|
1
|
|
|
1
|
|
2321
|
use AutoLoader qw(AUTOLOAD); |
|
|
1
|
|
|
|
|
2054
|
|
|
|
1
|
|
|
|
|
6
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
|
13
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
|
14
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# This allows declaration use Sylk ':all'; |
|
17
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
|
18
|
|
|
|
|
|
|
# will save memory. |
|
19
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
) ] ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT = qw( |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
); |
|
28
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
our $EOL = "\n"; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Preloaded methods go here. |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new |
|
36
|
|
|
|
|
|
|
{ |
|
37
|
1
|
|
|
1
|
0
|
17
|
my @this; |
|
38
|
|
|
|
|
|
|
|
|
39
|
1
|
50
|
|
|
|
7
|
if( ref($_[1]) eq 'HASH' ) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
1
|
|
|
|
|
2
|
$this[1] = [ @{ $_[1]->{FirstRecord} } ]; |
|
|
1
|
|
|
|
|
5
|
|
|
42
|
|
|
|
|
|
|
} |
|
43
|
|
|
|
|
|
|
|
|
44
|
1
|
|
|
|
|
2
|
$this[0] = []; |
|
45
|
1
|
|
|
|
|
4
|
return bless \@this; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub push_record |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
4
|
|
|
4
|
0
|
22
|
my $this = shift; |
|
51
|
|
|
|
|
|
|
|
|
52
|
4
|
50
|
|
|
|
10
|
if( ref($_[0]) eq 'ARRAY' ) |
|
53
|
|
|
|
|
|
|
{ |
|
54
|
4
|
|
|
|
|
4
|
push @{ $this->[0] }, $_[0]; |
|
|
4
|
|
|
|
|
15
|
|
|
55
|
|
|
|
|
|
|
} else |
|
56
|
|
|
|
|
|
|
{ |
|
57
|
0
|
|
|
|
|
0
|
push @{ $this->[0] }, [ @_ ]; |
|
|
0
|
|
|
|
|
0
|
|
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub clear |
|
62
|
|
|
|
|
|
|
{ |
|
63
|
0
|
|
|
0
|
0
|
0
|
my $this = shift; |
|
64
|
0
|
|
|
|
|
0
|
@{ $this->[0] } = (); |
|
|
0
|
|
|
|
|
0
|
|
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
2
|
|
|
2
|
|
57
|
sub _SYLK_HEAD { "ID;PWXL;N;E" . $EOL } |
|
68
|
2
|
|
|
2
|
|
9
|
sub _SYLK_TAIL { "E" } |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
sub print |
|
72
|
|
|
|
|
|
|
{ |
|
73
|
2
|
|
|
2
|
0
|
9
|
my $this = shift; |
|
74
|
2
|
|
|
|
|
3
|
my $output = shift; |
|
75
|
2
|
|
|
|
|
5
|
my $headers = $this->[1]; |
|
76
|
2
|
|
|
|
|
2
|
my $line = 0; |
|
77
|
|
|
|
|
|
|
|
|
78
|
2
|
100
|
|
|
|
6
|
if( ref($output) eq 'SCALAR' ) { $$output .= _SYLK_HEAD(); } |
|
|
1
|
|
|
|
|
10
|
|
|
79
|
1
|
|
|
|
|
5
|
else { print $output _SYLK_HEAD(); } |
|
80
|
|
|
|
|
|
|
|
|
81
|
2
|
50
|
|
|
|
8
|
if( $headers ) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
2
|
|
|
|
|
3
|
$line = 1; |
|
84
|
2
|
|
|
|
|
7
|
_print_sylk_line( $output, $line, $headers ); |
|
85
|
|
|
|
|
|
|
} |
|
86
|
2
|
|
|
|
|
3
|
for my $r( @{ $this->[0] } ) |
|
|
2
|
|
|
|
|
4
|
|
|
87
|
|
|
|
|
|
|
{ |
|
88
|
8
|
|
|
|
|
10
|
++$line; |
|
89
|
8
|
|
|
|
|
13
|
_print_sylk_line( $output, $line, $r ); |
|
90
|
|
|
|
|
|
|
} |
|
91
|
2
|
100
|
|
|
|
6
|
if( ref($output) eq 'SCALAR' ) { $$output .= _SYLK_TAIL(); } |
|
|
1
|
|
|
|
|
4
|
|
|
92
|
1
|
|
|
|
|
4
|
else { print $output _SYLK_TAIL(); } |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub as_string |
|
96
|
|
|
|
|
|
|
{ |
|
97
|
1
|
|
|
1
|
0
|
10
|
my $this = shift; |
|
98
|
1
|
|
|
|
|
1
|
my $output; |
|
99
|
1
|
|
|
|
|
3
|
$this->print(\$output); |
|
100
|
1
|
|
|
|
|
9
|
return $output; |
|
101
|
|
|
|
|
|
|
} |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my %encodings = |
|
104
|
|
|
|
|
|
|
( |
|
105
|
|
|
|
|
|
|
'à' => 'NAa', |
|
106
|
|
|
|
|
|
|
'è' => 'NAe', |
|
107
|
|
|
|
|
|
|
'é' => 'NBe', |
|
108
|
|
|
|
|
|
|
'ò' => 'NAo', |
|
109
|
|
|
|
|
|
|
'ç' => 'NKc', |
|
110
|
|
|
|
|
|
|
'ì' => 'NAi', |
|
111
|
|
|
|
|
|
|
'°' => 'N0' |
|
112
|
|
|
|
|
|
|
); |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $encodings_charlist = join "", keys %encodings; |
|
115
|
|
|
|
|
|
|
sub _sylk_escape |
|
116
|
|
|
|
|
|
|
{ |
|
117
|
30
|
|
|
30
|
|
113
|
$_[0] =~ s/([$encodings_charlist])/chr(27) . $encodings{$1}/ge |
|
|
3
|
|
|
|
|
15
|
|
|
118
|
|
|
|
|
|
|
} |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub _print_sylk_line |
|
121
|
|
|
|
|
|
|
{ |
|
122
|
10
|
|
|
10
|
|
13
|
my ($output, $line, $record ) = @_; |
|
123
|
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
# my $out = "C;Y$line;"; |
|
125
|
10
|
|
|
|
|
10
|
my $out; |
|
126
|
|
|
|
|
|
|
|
|
127
|
10
|
|
|
|
|
10
|
my $count = 1; |
|
128
|
10
|
|
|
|
|
13
|
for my $f ( @$record ) |
|
129
|
|
|
|
|
|
|
{ |
|
130
|
30
|
|
|
|
|
46
|
_sylk_escape($f); |
|
131
|
30
|
|
|
|
|
59
|
$out .= "C;Y$line;X$count;K\"$f\"$EOL"; |
|
132
|
30
|
|
|
|
|
45
|
++$count; |
|
133
|
|
|
|
|
|
|
} |
|
134
|
10
|
100
|
|
|
|
22
|
if( ref($output) eq 'SCALAR' ) { $$output .= $out; } |
|
|
5
|
|
|
|
|
14
|
|
|
135
|
5
|
|
|
|
|
27
|
else { print $output $out; } |
|
136
|
|
|
|
|
|
|
} |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# Autoload methods go after =cut, and are processed by the autosplit program. |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
1; |
|
144
|
|
|
|
|
|
|
__END__ |