File | /usr/share/perl/5.10/SelectSaver.pm |
Statements Executed | 9 |
Total Time | 0.0002002 seconds |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
0 | 0 | 0 | 0s | 0s | BEGIN | SelectSaver::
0 | 0 | 0 | 0s | 0s | DESTROY | SelectSaver::
0 | 0 | 0 | 0s | 0s | new | SelectSaver::
Line | Stmts. | Exclusive Time | Avg. | Code |
---|---|---|---|---|
1 | package SelectSaver; | |||
2 | ||||
3 | 1 | 700ns | 700ns | our $VERSION = '1.01'; |
4 | ||||
5 | 1 | 24µs | 24µs | require 5.000; |
6 | 3 | 25µs | 8µs | use Carp; # spent 52µs making 1 call to Exporter::import |
7 | 3 | 146µs | 49µs | use Symbol; # spent 54µs making 1 call to Exporter::import |
8 | ||||
9 | sub new { | |||
10 | @_ >= 1 && @_ <= 2 or croak 'usage: new SelectSaver [FILEHANDLE]'; | |||
11 | my $fh = select; | |||
12 | my $self = bless \$fh, $_[0]; | |||
13 | select qualify($_[1], caller) if @_ > 1; | |||
14 | $self; | |||
15 | } | |||
16 | ||||
17 | sub DESTROY { | |||
18 | my $self = $_[0]; | |||
19 | select $$self; | |||
20 | } | |||
21 | ||||
22 | 1 | 4µs | 4µs | 1; |