← Index
NYTProf Performance Profile   « line view »
For /Users/brian/bin/perls/cpan5.26.1
  Run on Sat Dec 30 01:41:10 2017
Reported on Sat Dec 30 01:44:15 2017

Filename/usr/local/perls/perl-5.26.1/lib/5.26.1/Tie/StdHandle.pm
StatementsExecuted 9 statements in 659µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11132µs39µsTie::StdHandle::::BEGIN@3Tie::StdHandle::BEGIN@3
11117µs73µsTie::StdHandle::::BEGIN@6Tie::StdHandle::BEGIN@6
11112µs12µsTie::StdHandle::::BEGIN@5Tie::StdHandle::BEGIN@5
0000s0sCORE::::read CORE::read
0000s0sTie::StdHandle::::BINMODETie::StdHandle::BINMODE
0000s0sTie::StdHandle::::CLOSETie::StdHandle::CLOSE
0000s0sTie::StdHandle::::EOFTie::StdHandle::EOF
0000s0sTie::StdHandle::::FILENOTie::StdHandle::FILENO
0000s0sTie::StdHandle::::GETCTie::StdHandle::GETC
0000s0sTie::StdHandle::::OPENTie::StdHandle::OPEN
0000s0sTie::StdHandle::::READTie::StdHandle::READ
0000s0sTie::StdHandle::::READLINETie::StdHandle::READLINE
0000s0sTie::StdHandle::::SEEKTie::StdHandle::SEEK
0000s0sTie::StdHandle::::TELLTie::StdHandle::TELL
0000s0sTie::StdHandle::::TIEHANDLETie::StdHandle::TIEHANDLE
0000s0sTie::StdHandle::::WRITETie::StdHandle::WRITE
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Tie::StdHandle;
2
3246µs246µs
# spent 39µs (32+7) within Tie::StdHandle::BEGIN@3 which was called: # once (32µs+7µs) by Tie::Handle::BEGIN@8 at line 3
use strict;
# spent 39µs making 1 call to Tie::StdHandle::BEGIN@3 # spent 7µs making 1 call to strict::import
4
5247µs112µs
# spent 12µs within Tie::StdHandle::BEGIN@5 which was called: # once (12µs+0s) by Tie::Handle::BEGIN@8 at line 5
use Tie::Handle;
# spent 12µs making 1 call to Tie::StdHandle::BEGIN@5
62547µs2129µs
# spent 73µs (17+56) within Tie::StdHandle::BEGIN@6 which was called: # once (17µs+56µs) by Tie::Handle::BEGIN@8 at line 6
use vars qw(@ISA $VERSION);
# spent 73µs making 1 call to Tie::StdHandle::BEGIN@6 # spent 56µs making 1 call to vars::import
7112µs@ISA = 'Tie::Handle';
811µs$VERSION = '4.4';
9
10=head1 NAME
11
12Tie::StdHandle - base class definitions for tied handles
13
14=head1 SYNOPSIS
15
16 package NewHandle;
17 require Tie::Handle;
18
19 @ISA = qw(Tie::Handle);
20
21 sub READ { ... } # Provide a needed method
22 sub TIEHANDLE { ... } # Overrides inherited method
23
24
25 package main;
26
27 tie *FH, 'NewHandle';
28
29=head1 DESCRIPTION
30
31The B<Tie::StdHandle> package provide most methods for file handles described
32in L<perltie> (the exceptions are C<UNTIE> and C<DESTROY>). It causes tied
33file handles to behave exactly like standard file handles and allow for
34selective overwriting of methods.
35
36=cut
37
38sub TIEHANDLE
39{
40 my $class = shift;
41 my $fh = \do { local *HANDLE};
42 bless $fh,$class;
43 $fh->OPEN(@_) if (@_);
44 return $fh;
45}
46
47sub EOF { eof($_[0]) }
48sub TELL { tell($_[0]) }
49sub FILENO { fileno($_[0]) }
50sub SEEK { seek($_[0],$_[1],$_[2]) }
51sub CLOSE { close($_[0]) }
52sub BINMODE { binmode($_[0]) }
53
54sub OPEN
55{
56 $_[0]->CLOSE if defined($_[0]->FILENO);
57 @_ == 2 ? open($_[0], $_[1]) : open($_[0], $_[1], $_[2]);
58}
59
60sub READ { &CORE::read(shift, \shift, @_) }
61sub READLINE { my $fh = $_[0]; <$fh> }
62sub GETC { getc($_[0]) }
63
64sub WRITE
65{
66 my $fh = $_[0];
67 local $\; # don't print any line terminator
68 print $fh substr($_[1], $_[3], $_[2]);
69}
70
71
7216µs1;