← Index
NYTProf Performance Profile   « line view »
For Makefile.PL
  Run on Sun Mar 1 16:04:44 2015
Reported on Sun Mar 1 16:09:02 2015

FilenameC:/tmp64ng/perl/lib/DirHandle.pm
StatementsExecuted 60 statements in 0s
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
1110s0sDirHandle::::BEGIN@31DirHandle::BEGIN@31
1110s0sDirHandle::::BEGIN@32DirHandle::BEGIN@32
1110s0sDirHandle::::BEGIN@50DirHandle::BEGIN@50
6210s0sDirHandle::::CORE:closedirDirHandle::CORE:closedir (opcode)
3110s0sDirHandle::::CORE:open_dirDirHandle::CORE:open_dir (opcode)
3110s0sDirHandle::::CORE:readdirDirHandle::CORE:readdir (opcode)
3110s0sDirHandle::::DESTROYDirHandle::DESTROY
3110s0sDirHandle::::closeDirHandle::close
3110s0sDirHandle::::newDirHandle::new
3110s0sDirHandle::::openDirHandle::open
3110s0sDirHandle::::readDirHandle::read
0000s0sDirHandle::::rewindDirHandle::rewind
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1package DirHandle;
2
310sour $VERSION = '1.04';
4
5=head1 NAME
6
7DirHandle - supply object methods for directory handles
8
9=head1 SYNOPSIS
10
11 use DirHandle;
12 $d = DirHandle->new(".");
13 if (defined $d) {
14 while (defined($_ = $d->read)) { something($_); }
15 $d->rewind;
16 while (defined($_ = $d->read)) { something_else($_); }
17 undef $d;
18 }
19
20=head1 DESCRIPTION
21
22The C<DirHandle> method provide an alternative interface to the
23opendir(), closedir(), readdir(), and rewinddir() functions.
24
25The only objective benefit to using C<DirHandle> is that it avoids
26namespace pollution by creating globs to hold directory handles.
27
28=cut
29
3010srequire 5.000;
3120s20s
# spent 0s within DirHandle::BEGIN@31 which was called: # once (0s+0s) by ExtUtils::MM_Unix::BEGIN@10 at line 31
use Carp;
# spent 0s making 1 call to DirHandle::BEGIN@31 # spent 0s making 1 call to Exporter::import
3220s20s
# spent 0s within DirHandle::BEGIN@32 which was called: # once (0s+0s) by ExtUtils::MM_Unix::BEGIN@10 at line 32
use Symbol;
# spent 0s making 1 call to DirHandle::BEGIN@32 # spent 0s making 1 call to Exporter::import
33
34
# spent 0s within DirHandle::new which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::lsdir at line 2331 of ExtUtils/MM_Unix.pm, avg 0s/call
sub new {
3530s @_ >= 1 && @_ <= 2 or croak 'usage: DirHandle->new( [DIRNAME] )';
3630s my $class = shift;
3730s30s my $dh = gensym;
# spent 0s making 3 calls to Symbol::gensym, avg 0s/call
3830s if (@_) {
39 DirHandle::open($dh, $_[0])
40 or return undef;
41 }
4230s bless $dh, $class;
43}
44
45
# spent 0s within DirHandle::DESTROY which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::lsdir at line 1309 of ExtUtils/MM_Unix.pm, avg 0s/call
sub DESTROY {
4630s my ($dh) = @_;
47 # Don't warn about already being closed as it may have been closed
48 # correctly, or maybe never opened at all.
4930s local($., $@, $!, $^E, $?);
5020s20s
# spent 0s within DirHandle::BEGIN@50 which was called: # once (0s+0s) by ExtUtils::MM_Unix::BEGIN@10 at line 50
no warnings 'io';
# spent 0s making 1 call to DirHandle::BEGIN@50 # spent 0s making 1 call to warnings::unimport
5130s30s closedir($dh);
# spent 0s making 3 calls to DirHandle::CORE:closedir, avg 0s/call
52}
53
54
# spent 0s within DirHandle::open which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::lsdir at line 2332 of ExtUtils/MM_Unix.pm, avg 0s/call
sub open {
5530s @_ == 2 or croak 'usage: $dh->open(DIRNAME)';
5630s my ($dh, $dirname) = @_;
5730s30s opendir($dh, $dirname);
# spent 0s making 3 calls to DirHandle::CORE:open_dir, avg 0s/call
58}
59
60
# spent 0s within DirHandle::close which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::lsdir at line 2334 of ExtUtils/MM_Unix.pm, avg 0s/call
sub close {
6130s @_ == 1 or croak 'usage: $dh->close()';
6230s my ($dh) = @_;
6330s30s closedir($dh);
# spent 0s making 3 calls to DirHandle::CORE:closedir, avg 0s/call
64}
65
66
# spent 0s within DirHandle::read which was called 3 times, avg 0s/call: # 3 times (0s+0s) by ExtUtils::MM_Unix::lsdir at line 2333 of ExtUtils/MM_Unix.pm, avg 0s/call
sub read {
6730s @_ == 1 or croak 'usage: $dh->read()';
6830s my ($dh) = @_;
6930s30s readdir($dh);
# spent 0s making 3 calls to DirHandle::CORE:readdir, avg 0s/call
70}
71
72sub rewind {
73 @_ == 1 or croak 'usage: $dh->rewind()';
74 my ($dh) = @_;
75 rewinddir($dh);
76}
77
7810s1;
 
# spent 0s within DirHandle::CORE:closedir which was called 6 times, avg 0s/call: # 3 times (0s+0s) by DirHandle::close at line 63, avg 0s/call # 3 times (0s+0s) by DirHandle::DESTROY at line 51, avg 0s/call
sub DirHandle::CORE:closedir; # opcode
# spent 0s within DirHandle::CORE:open_dir which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DirHandle::open at line 57, avg 0s/call
sub DirHandle::CORE:open_dir; # opcode
# spent 0s within DirHandle::CORE:readdir which was called 3 times, avg 0s/call: # 3 times (0s+0s) by DirHandle::read at line 69, avg 0s/call
sub DirHandle::CORE:readdir; # opcode