line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlIO::via::UnPod; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION= '0.07'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# be as strict as possible |
6
|
2
|
|
|
2
|
|
111894
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
872
|
|
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
|
1150
|
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
|
7
|
local($_); |
36
|
4
|
|
|
|
|
27
|
while ( defined( $_= readline( $_[1] ) ) ) { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# pod, and the end of it |
39
|
16
|
100
|
|
|
|
40
|
if ( m#^=[a-zA-Z]# ) { |
|
|
100
|
|
|
|
|
|
40
|
5
|
|
|
|
|
11
|
$_[0]->{insrc}= m#^=cut#; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# still in source |
44
|
|
|
|
|
|
|
elsif ( $_[0]->{insrc} ) { |
45
|
3
|
|
|
|
|
11
|
return $_; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
1
|
|
|
|
|
12
|
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
|
2
|
|
|
2
|
|
112
|
foreach ( split( m#(?<=$/)#, $_[1] ) ) { |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# pod, and the end of it |
64
|
17
|
100
|
|
|
|
43
|
if ( m#^=[a-zA-Z]# ) { |
|
|
100
|
|
|
|
|
|
65
|
5
|
|
|
|
|
9
|
$_[0]->{insrc}= m#^=cut#; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# still in source |
69
|
|
|
|
|
|
|
elsif ( $_[0]->{insrc} ) { |
70
|
4
|
100
|
|
|
|
6
|
return -1 if !print {$_[2]} $_; |
|
4
|
|
|
|
|
15
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
1
|
|
|
|
|
7
|
return length( $_[1] ); |
75
|
|
|
|
|
|
|
} #WRITE |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__END__ |