← Index
Performance Profile   « block view • line view • sub view »
For t/test-parsing
  Run on Sun Nov 14 09:49:57 2010
Reported on Sun Nov 14 09:50:12 2010

File /usr/lib/perl/5.10/IO/File.pm
Statements Executed 32
Total Time 0.0009826 seconds
Subroutines — ordered by exclusive time
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
0000s0sIO::File::::BEGINIO::File::BEGIN
0000s0sIO::File::::binmodeIO::File::binmode
0000s0sIO::File::::newIO::File::new
0000s0sIO::File::::openIO::File::open
LineStmts.Exclusive
Time
Avg.Code
1#
2
3package IO::File;
4
5340µs13µsuse 5.006_001;
6360µs20µsuse strict;
# spent 7µs making 1 call to strict::import
71600ns600nsour($VERSION, @EXPORT, @EXPORT_OK, @ISA);
8334µs11µsuse Carp;
# spent 75µs making 1 call to Exporter::import
9331µs10µsuse Symbol;
# spent 52µs making 1 call to Exporter::import
103151µs50µsuse SelectSaver;
# spent 3µs making 1 call to import
113120µs40µsuse IO::Seekable;
# spent 61µs making 1 call to Exporter::import
123434µs145µsuse File::Spec;
# spent 4µs making 1 call to import
13
141600ns600nsrequire Exporter;
15
16116µs16µs@ISA = qw(IO::Handle IO::Seekable Exporter);
17
181500ns500ns$VERSION = "1.14";
19
2011µs1µs@EXPORT = @IO::Seekable::EXPORT;
21
221600ns600nseval {
23 # Make all Fcntl O_XXX constants available for importing
241500ns500ns require Fcntl;
25150µs50µs my @O = grep /^O_/, @Fcntl::EXPORT;
26112µs12µs Fcntl->import(@O); # first we import what we want to export
# spent 196µs making 1 call to Exporter::import
27117µs17µs push(@EXPORT, @O);
28};
29
30################################################
31## Constructor
32##
33
34sub new {
35 my $type = shift;
36 my $class = ref($type) || $type || "IO::File";
37 @_ >= 0 && @_ <= 3
38 or croak "usage: new $class [FILENAME [,MODE [,PERMS]]]";
39 my $fh = $class->SUPER::new();
40 if (@_) {
41 $fh->open(@_)
42 or return undef;
43 }
44 $fh;
45}
46
47################################################
48## Open
49##
50
51sub open {
52 @_ >= 2 && @_ <= 4 or croak 'usage: $fh->open(FILENAME [,MODE [,PERMS]])';
53 my ($fh, $file) = @_;
54 if (@_ > 2) {
55 my ($mode, $perms) = @_[2, 3];
56 if ($mode =~ /^\d+$/) {
57 defined $perms or $perms = 0666;
58 return sysopen($fh, $file, $mode, $perms);
59 } elsif ($mode =~ /:/) {
60 return open($fh, $mode, $file) if @_ == 3;
61 croak 'usage: $fh->open(FILENAME, IOLAYERS)';
62 } else {
63 return open($fh, IO::Handle::_open_mode_string($mode), $file);
64 }
65 }
66 open($fh, $file);
67}
68
69################################################
70## Binmode
71##
72
73sub binmode {
74 ( @_ == 1 or @_ == 2 ) or croak 'usage $fh->binmode([LAYER])';
75
76 my($fh, $layer) = @_;
77
78 return binmode $$fh unless $layer;
79 return binmode $$fh, $layer;
80}
81
82114µs14µs1;