line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlIO::via::Pod; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$VERSION= '0.07'; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# be as struct as possible |
6
|
3
|
|
|
3
|
|
170562
|
use strict; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
886
|
|
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 the object with the right attributes |
24
|
2
|
|
|
2
|
1
|
1198
|
return bless { inpod => 0 }, $_[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
|
13
|
|
|
13
|
1
|
16
|
local( $_ ); |
36
|
13
|
|
|
|
|
36
|
while ( defined( $_= readline( $_[1] ) )) { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# pod, but not the end of it |
39
|
16
|
100
|
|
|
|
46
|
if ( m#^=[a-zA-Z]# ) { |
|
|
100
|
|
|
|
|
|
40
|
5
|
100
|
|
|
|
23
|
return $_ if $_[0]->{inpod}= !m#^=cut#; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# still in pod |
44
|
|
|
|
|
|
|
elsif ($_[0]->{inpod}) { |
45
|
8
|
|
|
|
|
19
|
return $_; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# we're done |
50
|
1
|
|
|
|
|
12
|
return undef; |
51
|
|
|
|
|
|
|
} #FILL |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
54
|
|
|
|
|
|
|
# IN: 1 instantiated object |
55
|
|
|
|
|
|
|
# 2 buffer to be written |
56
|
|
|
|
|
|
|
# 3 handle to write to |
57
|
|
|
|
|
|
|
# OUT: 1 number of bytes written |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub WRITE { |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# all lines |
62
|
3
|
|
|
3
|
|
219
|
foreach ( split( m#(?<=$/)#, $_[1] ) ) { |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
# not at end of pod |
65
|
18
|
100
|
|
|
|
52
|
if ( m#^=[a-zA-Z]# ) { |
|
|
100
|
|
|
|
|
|
66
|
6
|
100
|
|
|
|
16
|
if ($_[0]->{inpod} = !m#^=cut#) { |
67
|
5
|
100
|
|
|
|
6
|
return -1 if !print { $_[2] } $_; |
|
5
|
|
|
|
|
16
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# still in pod |
72
|
|
|
|
|
|
|
elsif ( $_[0]->{inpod} ) { |
73
|
9
|
100
|
|
|
|
8
|
return -1 if !print { $_[2] } $_; |
|
9
|
|
|
|
|
21
|
|
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
7
|
return length( $_[1] ); |
78
|
|
|
|
|
|
|
} #WRITE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
__END__ |