| Filename | /home/ss5/perl5/perlbrew/perls/perl-5.14.1/lib/5.14.1/x86_64-linux-thread-multi/File/Glob.pm |
| Statements | Executed 35 statements in 6.66ms |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 2.81ms | 2.87ms | File::Glob::BEGIN@7 |
| 1 | 1 | 1 | 77µs | 93µs | File::Glob::BEGIN@3 |
| 1 | 1 | 1 | 55µs | 1.11ms | File::Glob::import |
| 1 | 1 | 1 | 42µs | 90µs | File::Glob::BEGIN@50 |
| 1 | 1 | 1 | 16µs | 16µs | File::Glob::CORE:match (opcode) |
| 1 | 1 | 1 | 6µs | 6µs | File::Glob::GLOB_CSH (xsub) |
| 0 | 0 | 0 | 0s | 0s | File::Glob::csh_glob |
| 0 | 0 | 0 | 0s | 0s | File::Glob::glob |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package File::Glob; | ||||
| 2 | |||||
| 3 | 2 | 255µs | 2 | 109µs | # spent 93µs (77+16) within File::Glob::BEGIN@3 which was called:
# once (77µs+16µs) by Config::General::BEGIN@22 at line 3 # spent 93µs making 1 call to File::Glob::BEGIN@3
# spent 16µs making 1 call to strict::import |
| 4 | 1 | 3µs | our($VERSION, @ISA, @EXPORT_OK, @EXPORT_FAIL, %EXPORT_TAGS, $DEFAULT_FLAGS); | ||
| 5 | |||||
| 6 | 1 | 2µs | require XSLoader; | ||
| 7 | 2 | 3.43ms | 2 | 2.92ms | # spent 2.87ms (2.81+56µs) within File::Glob::BEGIN@7 which was called:
# once (2.81ms+56µs) by Config::General::BEGIN@22 at line 7 # spent 2.87ms making 1 call to File::Glob::BEGIN@7
# spent 56µs making 1 call to feature::import |
| 8 | |||||
| 9 | 1 | 27µs | @ISA = qw(Exporter); | ||
| 10 | |||||
| 11 | # NOTE: The glob() export is only here for compatibility with 5.6.0. | ||||
| 12 | # csh_glob() should not be used directly, unless you know what you're doing. | ||||
| 13 | |||||
| 14 | 1 | 19µs | %EXPORT_TAGS = ( | ||
| 15 | 'glob' => [ qw( | ||||
| 16 | GLOB_ABEND | ||||
| 17 | GLOB_ALPHASORT | ||||
| 18 | GLOB_ALTDIRFUNC | ||||
| 19 | GLOB_BRACE | ||||
| 20 | GLOB_CSH | ||||
| 21 | GLOB_ERR | ||||
| 22 | GLOB_ERROR | ||||
| 23 | GLOB_LIMIT | ||||
| 24 | GLOB_MARK | ||||
| 25 | GLOB_NOCASE | ||||
| 26 | GLOB_NOCHECK | ||||
| 27 | GLOB_NOMAGIC | ||||
| 28 | GLOB_NOSORT | ||||
| 29 | GLOB_NOSPACE | ||||
| 30 | GLOB_QUOTE | ||||
| 31 | GLOB_TILDE | ||||
| 32 | glob | ||||
| 33 | bsd_glob | ||||
| 34 | ) ], | ||||
| 35 | ); | ||||
| 36 | |||||
| 37 | 1 | 16µs | @EXPORT_OK = (@{$EXPORT_TAGS{'glob'}}, 'csh_glob'); | ||
| 38 | |||||
| 39 | 1 | 2µs | $VERSION = '1.12'; | ||
| 40 | |||||
| 41 | # spent 1.11ms (55µs+1.05) within File::Glob::import which was called:
# once (55µs+1.05ms) by Config::General::BEGIN@22 at line 22 of Config/General.pm | ||||
| 42 | 1 | 2µs | require Exporter; | ||
| 43 | 1 | 5µs | local $Exporter::ExportLevel = $Exporter::ExportLevel + 1; | ||
| 44 | 2 | 1µs | Exporter::import(grep { | ||
| 45 | 1 | 25µs | 1 | 1.05ms | my $passthrough; # spent 1.05ms making 1 call to Exporter::import |
| 46 | 2 | 6µs | given ($_) { | ||
| 47 | 2 | 7µs | $DEFAULT_FLAGS &= ~GLOB_NOCASE() when ':case'; | ||
| 48 | 2 | 2µs | $DEFAULT_FLAGS |= GLOB_NOCASE() when ':nocase'; | ||
| 49 | 2 | 2µs | when (':globally') { | ||
| 50 | 2 | 1.88ms | 2 | 139µs | # spent 90µs (42+49) within File::Glob::BEGIN@50 which was called:
# once (42µs+49µs) by Config::General::BEGIN@22 at line 50 # spent 90µs making 1 call to File::Glob::BEGIN@50
# spent 48µs making 1 call to warnings::unimport |
| 51 | *CORE::GLOBAL::glob = \&File::Glob::csh_glob; | ||||
| 52 | } | ||||
| 53 | 2 | 2µs | $passthrough = 1; | ||
| 54 | } | ||||
| 55 | 2 | 2µs | $passthrough; | ||
| 56 | } @_); | ||||
| 57 | } | ||||
| 58 | |||||
| 59 | 1 | 848µs | 1 | 802µs | XSLoader::load(); # spent 802µs making 1 call to XSLoader::load |
| 60 | |||||
| 61 | 1 | 28µs | 1 | 6µs | $DEFAULT_FLAGS = GLOB_CSH(); # spent 6µs making 1 call to File::Glob::GLOB_CSH |
| 62 | 1 | 34µs | 1 | 16µs | if ($^O =~ /^(?:MSWin32|VMS|os2|dos|riscos)$/) { # spent 16µs making 1 call to File::Glob::CORE:match |
| 63 | $DEFAULT_FLAGS |= GLOB_NOCASE(); | ||||
| 64 | } | ||||
| 65 | |||||
| 66 | # File::Glob::glob() is deprecated because its prototype is different from | ||||
| 67 | # CORE::glob() (use bsd_glob() instead) | ||||
| 68 | sub glob { | ||||
| 69 | splice @_, 1; # don't pass PL_glob_index as flags! | ||||
| 70 | goto &bsd_glob; | ||||
| 71 | } | ||||
| 72 | |||||
| 73 | ## borrowed heavily from gsar's File::DosGlob | ||||
| 74 | 1 | 1µs | my %iter; | ||
| 75 | 1 | 600ns | my %entries; | ||
| 76 | |||||
| 77 | sub csh_glob { | ||||
| 78 | my $pat = shift; | ||||
| 79 | my $cxix = shift; | ||||
| 80 | my @pat; | ||||
| 81 | |||||
| 82 | # glob without args defaults to $_ | ||||
| 83 | $pat = $_ unless defined $pat; | ||||
| 84 | |||||
| 85 | # extract patterns | ||||
| 86 | $pat =~ s/^\s+//; # Protect against empty elements in | ||||
| 87 | $pat =~ s/\s+$//; # things like < *.c> and <*.c >. | ||||
| 88 | # These alone shouldn't trigger ParseWords. | ||||
| 89 | if ($pat =~ /\s/) { | ||||
| 90 | # XXX this is needed for compatibility with the csh | ||||
| 91 | # implementation in Perl. Need to support a flag | ||||
| 92 | # to disable this behavior. | ||||
| 93 | require Text::ParseWords; | ||||
| 94 | @pat = Text::ParseWords::parse_line('\s+',0,$pat); | ||||
| 95 | } | ||||
| 96 | |||||
| 97 | # assume global context if not provided one | ||||
| 98 | $cxix = '_G_' unless defined $cxix; | ||||
| 99 | $iter{$cxix} = 0 unless exists $iter{$cxix}; | ||||
| 100 | |||||
| 101 | # if we're just beginning, do it all first | ||||
| 102 | if ($iter{$cxix} == 0) { | ||||
| 103 | if (@pat) { | ||||
| 104 | $entries{$cxix} = [ map { doglob($_, $DEFAULT_FLAGS) } @pat ]; | ||||
| 105 | } | ||||
| 106 | else { | ||||
| 107 | $entries{$cxix} = [ doglob($pat, $DEFAULT_FLAGS) ]; | ||||
| 108 | } | ||||
| 109 | } | ||||
| 110 | |||||
| 111 | # chuck it all out, quick or slow | ||||
| 112 | if (wantarray) { | ||||
| 113 | delete $iter{$cxix}; | ||||
| 114 | return @{delete $entries{$cxix}}; | ||||
| 115 | } | ||||
| 116 | else { | ||||
| 117 | if ($iter{$cxix} = scalar @{$entries{$cxix}}) { | ||||
| 118 | return shift @{$entries{$cxix}}; | ||||
| 119 | } | ||||
| 120 | else { | ||||
| 121 | # return undef for EOL | ||||
| 122 | delete $iter{$cxix}; | ||||
| 123 | delete $entries{$cxix}; | ||||
| 124 | return undef; | ||||
| 125 | } | ||||
| 126 | } | ||||
| 127 | } | ||||
| 128 | |||||
| 129 | 1 | 60µs | 1; | ||
| 130 | __END__ | ||||
# spent 16µs within File::Glob::CORE:match which was called:
# once (16µs+0s) by Config::General::BEGIN@22 at line 62 | |||||
# spent 6µs within File::Glob::GLOB_CSH which was called:
# once (6µs+0s) by Config::General::BEGIN@22 at line 61 |