← Index
Performance Profile   « block view • line view • sub view »
For /wise/base/deliv/dev/bin/getfix
  Run on Thu May 20 15:30:03 2010
Reported on Thu May 20 16:25:36 2010

File/opt/wise/lib/perl5/5.10.0/SelectSaver.pm
Statements Executed9
Total Time0.000162 seconds

Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
00000SelectSaver::BEGIN
00000SelectSaver::DESTROY
00000SelectSaver::new

LineStmts.Exclusive
Time
Avg.Code
1package SelectSaver;
2
311.0e-61.0e-6our $VERSION = '1.01';
4
5=head1 NAME
6
7SelectSaver - save and restore selected file handle
8
9=head1 SYNOPSIS
10
11 use SelectSaver;
12
13 {
14 my $saver = new SelectSaver(FILEHANDLE);
15 # FILEHANDLE is selected
16 }
17 # previous handle is selected
18
19 {
20 my $saver = new SelectSaver;
21 # new handle may be selected, or not
22 }
23 # previous handle is selected
24
25=head1 DESCRIPTION
26
27A C<SelectSaver> object contains a reference to the file handle that
28was selected when it was created. If its C<new> method gets an extra
29parameter, then that parameter is selected; otherwise, the selected
30file handle remains unchanged.
31
32When a C<SelectSaver> is destroyed, it re-selects the file handle
33that was selected when it was created.
34
35=cut
36
3711.8e-51.8e-5require 5.000;
3832.7e-59.0e-6use Carp;
# spent 44µs making 1 call to Exporter::import
3930.000113.7e-5use Symbol;
# spent 52µs making 1 call to Exporter::import
40
41sub new {
42 @_ >= 1 && @_ <= 2 or croak 'usage: new SelectSaver [FILEHANDLE]';
43 my $fh = select;
44 my $self = bless \$fh, $_[0];
45 select qualify($_[1], caller) if @_ > 1;
46 $self;
47}
48
49sub DESTROY {
50 my $self = $_[0];
51 select $$self;
52}
53
5414.0e-64.0e-61;