← Index
NYTProf Performance Profile   « block view • line view • sub view »
For conv.pl
  Run on Sun Nov 14 22:50:31 2010
Reported on Sun Nov 14 22:51:20 2010

Filename/usr/share/perl/5.10/Tie/Hash.pm
StatementsExecuted 9 statements in 904µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11124µs98µsTie::Hash::::BEGIN@5 Tie::Hash::BEGIN@5
11118µs204µsTie::Hash::::BEGIN@6 Tie::Hash::BEGIN@6
1117µs7µsTie::StdHash::::TIEHASH Tie::StdHash::TIEHASH
0000s0sTie::ExtraHash::::CLEARTie::ExtraHash::CLEAR
0000s0sTie::ExtraHash::::DELETETie::ExtraHash::DELETE
0000s0sTie::ExtraHash::::EXISTSTie::ExtraHash::EXISTS
0000s0sTie::ExtraHash::::FETCHTie::ExtraHash::FETCH
0000s0sTie::ExtraHash::::FIRSTKEYTie::ExtraHash::FIRSTKEY
0000s0sTie::ExtraHash::::NEXTKEYTie::ExtraHash::NEXTKEY
0000s0sTie::ExtraHash::::SCALARTie::ExtraHash::SCALAR
0000s0sTie::ExtraHash::::STORETie::ExtraHash::STORE
0000s0sTie::ExtraHash::::TIEHASHTie::ExtraHash::TIEHASH
0000s0sTie::Hash::::CLEAR Tie::Hash::CLEAR
0000s0sTie::Hash::::EXISTS Tie::Hash::EXISTS
0000s0sTie::Hash::::TIEHASH Tie::Hash::TIEHASH
0000s0sTie::Hash::::new Tie::Hash::new
0000s0sTie::StdHash::::CLEAR Tie::StdHash::CLEAR
0000s0sTie::StdHash::::DELETE Tie::StdHash::DELETE
0000s0sTie::StdHash::::EXISTS Tie::StdHash::EXISTS
0000s0sTie::StdHash::::FETCH Tie::StdHash::FETCH
0000s0sTie::StdHash::::FIRSTKEY Tie::StdHash::FIRSTKEY
0000s0sTie::StdHash::::NEXTKEY Tie::StdHash::NEXTKEY
0000s0sTie::StdHash::::SCALAR Tie::StdHash::SCALAR
0000s0sTie::StdHash::::STORE Tie::StdHash::STORE
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package Tie::Hash;
2
311µsour $VERSION = '1.03';
4
5343µs2172µs
# spent 98µs (24+74) within Tie::Hash::BEGIN@5 which was called: # once (24µs+74µs) by POSIX::SigRt::BEGIN@64 at line 5
use Carp;
# spent 98µs making 1 call to Tie::Hash::BEGIN@5 # spent 74µs making 1 call to Exporter::import
63847µs2390µs
# spent 204µs (18+186) within Tie::Hash::BEGIN@6 which was called: # once (18µs+186µs) by POSIX::SigRt::BEGIN@64 at line 6
use warnings::register;
# spent 204µs making 1 call to Tie::Hash::BEGIN@6 # spent 186µs making 1 call to warnings::register::import
7
8sub new {
9 my $pkg = shift;
10 $pkg->TIEHASH(@_);
11}
12
13# Grandfather "new"
14
15sub TIEHASH {
16 my $pkg = shift;
17 if (defined &{"${pkg}::new"}) {
18 warnings::warnif("WARNING: calling ${pkg}->new since ${pkg}->TIEHASH is missing");
19 $pkg->new(@_);
20 }
21 else {
22 croak "$pkg doesn't define a TIEHASH method";
23 }
24}
25
26sub EXISTS {
27 my $pkg = ref $_[0];
28 croak "$pkg doesn't define an EXISTS method";
29}
30
31sub CLEAR {
32 my $self = shift;
33 my $key = $self->FIRSTKEY(@_);
34 my @keys;
35
36 while (defined $key) {
37 push @keys, $key;
38 $key = $self->NEXTKEY(@_, $key);
39 }
40 foreach $key (@keys) {
41 $self->DELETE(@_, $key);
42 }
43}
44
45# The Tie::StdHash package implements standard perl hash behaviour.
46# It exists to act as a base class for classes which only wish to
47# alter some parts of their behaviour.
48
49package Tie::StdHash;
50# @ISA = qw(Tie::Hash); # would inherit new() only
51
5219µs
# spent 7µs within Tie::StdHash::TIEHASH which was called: # once (7µs+0s) by MARC::Charset::Table::BEGIN@36 at line 71 of POSIX.pm
sub TIEHASH { bless {}, $_[0] }
53sub STORE { $_[0]->{$_[1]} = $_[2] }
54sub FETCH { $_[0]->{$_[1]} }
55sub FIRSTKEY { my $a = scalar keys %{$_[0]}; each %{$_[0]} }
56sub NEXTKEY { each %{$_[0]} }
57sub EXISTS { exists $_[0]->{$_[1]} }
58sub DELETE { delete $_[0]->{$_[1]} }
59sub CLEAR { %{$_[0]} = () }
60sub SCALAR { scalar %{$_[0]} }
61
62package Tie::ExtraHash;
63
64sub TIEHASH { my $p = shift; bless [{}, @_], $p }
65sub STORE { $_[0][0]{$_[1]} = $_[2] }
66sub FETCH { $_[0][0]{$_[1]} }
67sub FIRSTKEY { my $a = scalar keys %{$_[0][0]}; each %{$_[0][0]} }
68sub NEXTKEY { each %{$_[0][0]} }
69sub EXISTS { exists $_[0][0]->{$_[1]} }
70sub DELETE { delete $_[0][0]->{$_[1]} }
71sub CLEAR { %{$_[0][0]} = () }
72sub SCALAR { scalar %{$_[0][0]} }
73
7414µs1;