Filename | /usr/local/share/perl/5.18.2/Stream/Buffered/PerlIO.pm |
Statements | Executed 7 statements in 147µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 8µs | 17µs | BEGIN@2 | Stream::Buffered::PerlIO::
1 | 1 | 1 | 6µs | 9µs | BEGIN@3 | Stream::Buffered::PerlIO::
1 | 1 | 1 | 5µs | 54µs | BEGIN@4 | Stream::Buffered::PerlIO::
0 | 0 | 0 | 0s | 0s | new | Stream::Buffered::PerlIO::
0 | 0 | 0 | 0s | 0s | |
0 | 0 | 0 | 0s | 0s | rewind | Stream::Buffered::PerlIO::
0 | 0 | 0 | 0s | 0s | size | Stream::Buffered::PerlIO::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package Stream::Buffered::PerlIO; | ||||
2 | 2 | 18µs | 2 | 26µs | # spent 17µs (8+9) within Stream::Buffered::PerlIO::BEGIN@2 which was called:
# once (8µs+9µs) by Stream::Buffered::BEGIN@8 at line 2 # spent 17µs making 1 call to Stream::Buffered::PerlIO::BEGIN@2
# spent 9µs making 1 call to strict::import |
3 | 2 | 18µs | 2 | 12µs | # spent 9µs (6+3) within Stream::Buffered::PerlIO::BEGIN@3 which was called:
# once (6µs+3µs) by Stream::Buffered::BEGIN@8 at line 3 # spent 9µs making 1 call to Stream::Buffered::PerlIO::BEGIN@3
# spent 3µs making 1 call to warnings::import |
4 | 2 | 109µs | 2 | 102µs | # spent 54µs (5+49) within Stream::Buffered::PerlIO::BEGIN@4 which was called:
# once (5µs+49µs) by Stream::Buffered::BEGIN@8 at line 4 # spent 54µs making 1 call to Stream::Buffered::PerlIO::BEGIN@4
# spent 49µs making 1 call to base::import |
5 | |||||
6 | sub new { | ||||
7 | my $class = shift; | ||||
8 | bless { buffer => '' }, $class; | ||||
9 | } | ||||
10 | |||||
11 | sub print { | ||||
12 | my $self = shift; | ||||
13 | $self->{buffer} .= "@_"; | ||||
14 | } | ||||
15 | |||||
16 | sub size { | ||||
17 | my $self = shift; | ||||
18 | length $self->{buffer}; | ||||
19 | } | ||||
20 | |||||
21 | sub rewind { | ||||
22 | my $self = shift; | ||||
23 | my $buffer = $self->{buffer}; | ||||
24 | open my $io, "<", \$buffer; | ||||
25 | bless $io, 'FileHandle'; # This makes $io work as FileHandle under 5.8, .10 and .11 :/ | ||||
26 | return $io; | ||||
27 | } | ||||
28 | |||||
29 | 1 | 2µs | 1; |