| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package PerlIO::via::UnPod; |
|
2
|
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION= '0.06'; |
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# be as strict as possible |
|
6
|
1
|
|
|
1
|
|
56625
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
252
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# satisfy -require- |
|
9
|
|
|
|
|
|
|
1; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
12
|
|
|
|
|
|
|
# |
|
13
|
|
|
|
|
|
|
# Standard Perl features |
|
14
|
|
|
|
|
|
|
# |
|
15
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
16
|
|
|
|
|
|
|
# IN: 1 class to bless with |
|
17
|
|
|
|
|
|
|
# 2 mode string (ignored) |
|
18
|
|
|
|
|
|
|
# 3 file handle of PerlIO layer below (ignored) |
|
19
|
|
|
|
|
|
|
# OUT: 1 blessed object |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub PUSHED { |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
# create object with right attributes |
|
24
|
2
|
|
|
2
|
0
|
1177
|
return bless { insrc => 1 }, $_[0]; |
|
25
|
|
|
|
|
|
|
} #PUSHED |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
28
|
|
|
|
|
|
|
# IN: 1 instantiated object |
|
29
|
|
|
|
|
|
|
# 2 handle to read from |
|
30
|
|
|
|
|
|
|
# OUT: 1 processed string (if any) |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub FILL { |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# process all lines |
|
35
|
4
|
|
|
4
|
0
|
6
|
local($_); |
|
36
|
4
|
|
|
|
|
29
|
while ( defined( $_= readline( $_[1] ) ) ) { |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# pod, and the end of it |
|
39
|
16
|
100
|
|
|
|
45
|
if ( m#^=[a-zA-Z]# ) { |
|
|
|
100
|
|
|
|
|
|
|
40
|
5
|
|
|
|
|
116
|
$_[0]->{insrc}= m#^=cut#; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# still in source |
|
44
|
|
|
|
|
|
|
elsif ( $_[0]->{insrc} ) { |
|
45
|
3
|
|
|
|
|
13
|
return $_; |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
16
|
return undef; |
|
50
|
|
|
|
|
|
|
} #FILL |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
53
|
|
|
|
|
|
|
# IN: 1 instantiated object |
|
54
|
|
|
|
|
|
|
# 2 buffer to be written |
|
55
|
|
|
|
|
|
|
# 3 handle to write to |
|
56
|
|
|
|
|
|
|
# OUT: 1 number of bytes written or -1 to indicate failure |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub WRITE { |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# all lines |
|
61
|
1
|
|
|
1
|
|
28
|
foreach ( split( m#(?<=$/)#, $_[1] ) ) { |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# pod, and the end of it |
|
64
|
16
|
100
|
|
|
|
37
|
if ( m#^=[a-zA-Z]# ) { |
|
|
|
100
|
|
|
|
|
|
|
65
|
5
|
|
|
|
|
10
|
$_[0]->{insrc}= m#^=cut#; |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# still in source |
|
69
|
|
|
|
|
|
|
elsif ( $_[0]->{insrc} ) { |
|
70
|
3
|
50
|
|
|
|
4
|
return -1 if !print {$_[2]} $_; |
|
|
3
|
|
|
|
|
10
|
|
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
7
|
return length( $_[1] ); |
|
75
|
|
|
|
|
|
|
} #WRITE |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |