line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Convert::EBCDIC; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
1381
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
81
|
|
4
|
2
|
|
|
2
|
|
13
|
use vars qw($VERSION @ISA @EXPORT_OK $ccsid819 $ccsid1047); |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
1076
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
@ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
11
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
12
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
13
|
|
|
|
|
|
|
@EXPORT_OK = qw( |
14
|
|
|
|
|
|
|
ascii2ebcdic ebcdic2ascii |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
$VERSION = '0.06'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
$ccsid819 = |
20
|
|
|
|
|
|
|
'\000\001\002\003\234\011\206\177\227\215\216\013\014\015\016\017' . |
21
|
|
|
|
|
|
|
'\020\021\022\023\235\205\010\207\030\031\222\217\034\035\036\037' . |
22
|
|
|
|
|
|
|
'\200\201\202\203\204\012\027\033\210\211\212\213\214\005\006\007' . |
23
|
|
|
|
|
|
|
'\220\221\026\223\224\225\226\004\230\231\232\233\024\025\236\032' . |
24
|
|
|
|
|
|
|
'\040\240\342\344\340\341\343\345\347\361\242\056\074\050\053\174' . |
25
|
|
|
|
|
|
|
'\046\351\352\353\350\355\356\357\354\337\041\044\052\051\073\254' . |
26
|
|
|
|
|
|
|
'\055\057\302\304\300\301\303\305\307\321\246\054\045\137\076\077' . |
27
|
|
|
|
|
|
|
'\370\311\312\313\310\315\316\317\314\140\072\043\100\047\075\042' . |
28
|
|
|
|
|
|
|
'\330\141\142\143\144\145\146\147\150\151\253\273\360\375\376\261' . |
29
|
|
|
|
|
|
|
'\260\152\153\154\155\156\157\160\161\162\252\272\346\270\306\244' . |
30
|
|
|
|
|
|
|
'\265\176\163\164\165\166\167\170\171\172\241\277\320\335\336\256' . |
31
|
|
|
|
|
|
|
'\136\243\245\267\251\247\266\274\275\276\133\135\257\250\264\327' . |
32
|
|
|
|
|
|
|
'\173\101\102\103\104\105\106\107\110\111\255\364\366\362\363\365' . |
33
|
|
|
|
|
|
|
'\175\112\113\114\115\116\117\120\121\122\271\373\374\371\372\377' . |
34
|
|
|
|
|
|
|
'\134\367\123\124\125\126\127\130\131\132\262\324\326\322\323\325' . |
35
|
|
|
|
|
|
|
'\060\061\062\063\064\065\066\067\070\071\263\333\334\331\332\237' ; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$ccsid1047 = |
38
|
|
|
|
|
|
|
'\000\001\002\003\234\011\206\177\227\215\216\013\014\015\016\017' . |
39
|
|
|
|
|
|
|
'\020\021\022\023\235\012\010\207\030\031\222\217\034\035\036\037' . |
40
|
|
|
|
|
|
|
'\200\201\202\203\204\205\027\033\210\211\212\213\214\005\006\007' . |
41
|
|
|
|
|
|
|
'\220\221\026\223\224\225\226\004\230\231\232\233\024\025\236\032' . |
42
|
|
|
|
|
|
|
'\040\240\342\344\340\341\343\345\347\361\242\056\074\050\053\174' . |
43
|
|
|
|
|
|
|
'\046\351\352\353\350\355\356\357\354\337\041\044\052\051\073\136' . |
44
|
|
|
|
|
|
|
'\055\057\302\304\300\301\303\305\307\321\246\054\045\137\076\077' . |
45
|
|
|
|
|
|
|
'\370\311\312\313\310\315\316\317\314\140\072\043\100\047\075\042' . |
46
|
|
|
|
|
|
|
'\330\141\142\143\144\145\146\147\150\151\253\273\360\375\376\261' . |
47
|
|
|
|
|
|
|
'\260\152\153\154\155\156\157\160\161\162\252\272\346\270\306\244' . |
48
|
|
|
|
|
|
|
'\265\176\163\164\165\166\167\170\171\172\241\277\320\133\336\256' . |
49
|
|
|
|
|
|
|
'\254\243\245\267\251\247\266\274\275\276\335\250\257\135\264\327' . |
50
|
|
|
|
|
|
|
'\173\101\102\103\104\105\106\107\110\111\255\364\366\362\363\365' . |
51
|
|
|
|
|
|
|
'\175\112\113\114\115\116\117\120\121\122\271\373\374\371\372\377' . |
52
|
|
|
|
|
|
|
'\134\367\123\124\125\126\127\130\131\132\262\324\326\322\323\325' . |
53
|
|
|
|
|
|
|
'\060\061\062\063\064\065\066\067\070\071\263\333\334\331\332\237' ; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
my $default = ($^O eq 'os390') ? $ccsid1047 : $ccsid819; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# Preloaded methods go here. |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub ebcdic2ascii { |
62
|
2
|
|
|
2
|
1
|
8
|
my $e = shift; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
168
|
eval '$e =~ tr/\000-\377/' . $default . '/'; |
65
|
|
|
|
|
|
|
|
66
|
2
|
|
|
|
|
7
|
return $e; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub ascii2ebcdic { |
70
|
2
|
|
|
2
|
1
|
15
|
my $a = shift; |
71
|
|
|
|
|
|
|
|
72
|
2
|
|
|
|
|
208
|
eval '$a =~ tr/' . $default . '/\000-\377/'; |
73
|
|
|
|
|
|
|
|
74
|
2
|
|
|
|
|
9
|
return $a; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub new { |
78
|
3
|
|
|
3
|
1
|
36
|
my $class = shift; |
79
|
3
|
|
66
|
|
|
14
|
my $lang = shift || $default; |
80
|
3
|
|
|
|
|
7
|
my $self = { }; |
81
|
3
|
|
|
|
|
423
|
$$self{a2e} = eval 'sub { my $a = shift; $a =~ tr/' . $lang . '/\000-\377/; return $a; }'; |
82
|
3
|
|
|
|
|
352
|
$$self{e2a} = eval 'sub { my $e = shift; $e =~ tr/\000-\377/' . $lang . '/; return $e; }'; |
83
|
3
|
|
|
|
|
9
|
bless $self, $class; |
84
|
|
|
|
|
|
|
|
85
|
3
|
|
|
|
|
10
|
return $self; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub toascii { |
89
|
3
|
|
|
3
|
1
|
19
|
my $self = shift; |
90
|
3
|
|
|
|
|
6
|
my $s = shift; |
91
|
|
|
|
|
|
|
|
92
|
3
|
|
|
|
|
3
|
return &{$$self{e2a}}($s); |
|
3
|
|
|
|
|
78
|
|
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub toebcdic { |
96
|
3
|
|
|
3
|
1
|
63
|
my $self = shift; |
97
|
3
|
|
|
|
|
7
|
my $s = shift; |
98
|
|
|
|
|
|
|
|
99
|
3
|
|
|
|
|
4
|
return &{$$self{a2e}}($s); |
|
3
|
|
|
|
|
104
|
|
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
__END__ |