line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PerlIO::via::trap; |
2
|
|
|
|
|
|
|
require Exporter; |
3
|
|
|
|
|
|
|
@ISA = 'Exporter'; |
4
|
|
|
|
|
|
|
@EXPORT = 'open'; |
5
|
|
|
|
|
|
|
$VERSION = '0.09'; |
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
83356
|
use strict; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
50
|
|
8
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
67
|
|
9
|
1
|
|
|
1
|
|
6
|
use IO::Handle; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
310
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $PASS = 0; |
12
|
|
|
|
|
|
|
|
13
|
4
|
|
|
4
|
0
|
1693
|
sub PUSHED { bless \*PUSHED,$_[0] } |
14
|
5
|
|
|
5
|
0
|
93
|
sub FILL { readline( $_[1] ) } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub SEEK { |
17
|
0
|
|
|
0
|
|
0
|
seek $_[3], $_[1], $_[2]; |
18
|
0
|
|
|
|
|
0
|
return 0; |
19
|
|
|
|
|
|
|
} #SEEK |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub WRITE { |
22
|
2
|
|
|
2
|
|
5
|
my ($obj, $buf, $fh) = @_; |
23
|
2
|
100
|
|
|
|
263
|
confess "attempt to write ".length($_[1])."bytes to $_[2]" unless $PASS; |
24
|
1
|
|
|
|
|
20
|
$fh->print($buf); |
25
|
|
|
|
|
|
|
} #WRITE |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub import { |
28
|
1
|
|
|
1
|
|
10
|
my $pkg = shift; |
29
|
1
|
50
|
|
|
|
5
|
return unless @_; |
30
|
1
|
|
|
|
|
2
|
my $sym = shift; |
31
|
1
|
|
|
|
|
129
|
$pkg->export('CORE::GLOBAL', $sym, @_); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub open (*;@) { |
35
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
239
|
|
36
|
4
|
100
|
|
4
|
0
|
1776
|
my $fh = $_[0] ? *{caller()."::$_[0]"} : $_[0]; |
|
2
|
|
|
|
|
14
|
|
37
|
4
|
|
|
|
|
13
|
my ($mode, $file) = @_[1,2]; |
38
|
|
|
|
|
|
|
|
39
|
4
|
100
|
|
|
|
15
|
unless (defined $file) { |
40
|
1
|
|
|
|
|
10
|
($mode, $file) = ($mode =~ /^(\+?(?:<|>>?|\|)?)(.+)$/); |
41
|
|
|
|
|
|
|
# XXX: should we take care of > here to avoid truncation? |
42
|
1
|
|
50
|
|
|
6
|
$mode ||= '<'; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
341
|
my $ret = CORE::open($fh, $mode, $file); |
46
|
1
|
|
|
1
|
|
10
|
binmode $fh, ':via(trap)'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
92
|
|
47
|
4
|
|
66
|
|
|
24
|
$_[0] ||= $fh; |
48
|
4
|
|
|
|
|
30
|
$ret; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
1; |
52
|
|
|
|
|
|
|
__END__ |