| Filename | /home/hejohns/perl5/lib/perl5/Data/Printer/Filter/GLOB.pm |
| Statements | Executed 16 statements in 316µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 8µs | 10µs | Data::Printer::Filter::GLOB::BEGIN@2 |
| 1 | 1 | 1 | 6µs | 142µs | Data::Printer::Filter::GLOB::BEGIN@7 |
| 1 | 1 | 1 | 6µs | 6µs | Data::Printer::Filter::GLOB::BEGIN@5 |
| 1 | 1 | 1 | 5µs | 19µs | Data::Printer::Filter::GLOB::BEGIN@22 |
| 1 | 1 | 1 | 4µs | 18µs | Data::Printer::Filter::GLOB::BEGIN@3 |
| 1 | 1 | 1 | 4µs | 16µs | Data::Printer::Filter::GLOB::BEGIN@4 |
| 1 | 1 | 1 | 2µs | 2µs | Data::Printer::Filter::GLOB::BEGIN@6 |
| 1 | 1 | 1 | 300ns | 300ns | Data::Printer::Filter::GLOB::__ANON__ (xsub) |
| 0 | 0 | 0 | 0s | 0s | Data::Printer::Filter::GLOB::__ANON__[:49] |
| 0 | 0 | 0 | 0s | 0s | Data::Printer::Filter::GLOB::parse |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package Data::Printer::Filter::GLOB; | ||||
| 2 | 2 | 17µs | 2 | 12µs | # spent 10µs (8+2) within Data::Printer::Filter::GLOB::BEGIN@2 which was called:
# once (8µs+2µs) by Data::Printer::Object::BEGIN@57 at line 2 # spent 10µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@2
# spent 2µs making 1 call to strict::import |
| 3 | 2 | 12µs | 2 | 33µs | # spent 18µs (4+14) within Data::Printer::Filter::GLOB::BEGIN@3 which was called:
# once (4µs+14µs) by Data::Printer::Object::BEGIN@57 at line 3 # spent 18µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@3
# spent 14µs making 1 call to warnings::import |
| 4 | 2 | 15µs | 2 | 29µs | # spent 16µs (4+12) within Data::Printer::Filter::GLOB::BEGIN@4 which was called:
# once (4µs+12µs) by Data::Printer::Object::BEGIN@57 at line 4 # spent 16µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@4
# spent 12µs making 1 call to Data::Printer::Filter::import |
| 5 | 2 | 15µs | 2 | 6µs | # spent 6µs (6+300ns) within Data::Printer::Filter::GLOB::BEGIN@5 which was called:
# once (6µs+300ns) by Data::Printer::Object::BEGIN@57 at line 5 # spent 6µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@5
# spent 300ns making 1 call to Data::Printer::Filter::GLOB::__ANON__ |
| 6 | 2 | 15µs | 1 | 2µs | # spent 2µs within Data::Printer::Filter::GLOB::BEGIN@6 which was called:
# once (2µs+0s) by Data::Printer::Object::BEGIN@57 at line 6 # spent 2µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@6 |
| 7 | 2 | 56µs | 2 | 278µs | # spent 142µs (6+136) within Data::Printer::Filter::GLOB::BEGIN@7 which was called:
# once (6µs+136µs) by Data::Printer::Object::BEGIN@57 at line 7 # spent 142µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@7
# spent 136µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 1 | 2µs | 1 | 16µs | filter 'GLOB' => \&parse; # spent 16µs making 1 call to Data::Printer::Filter::__ANON__[Data/Printer/Filter.pm:23] |
| 10 | |||||
| 11 | |||||
| 12 | sub parse { | ||||
| 13 | my ($glob, $ddp) = @_; | ||||
| 14 | |||||
| 15 | my $string = $ddp->maybe_colorize("$$glob", 'glob'); | ||||
| 16 | |||||
| 17 | # unfortunately, some systems (like Win32) do not | ||||
| 18 | # implement some of these flags (maybe not even | ||||
| 19 | # fcntl() itself, so we must wrap it. | ||||
| 20 | my $extra = ''; | ||||
| 21 | my $flags; | ||||
| 22 | 2 | 182µs | 2 | 34µs | # spent 19µs (5+15) within Data::Printer::Filter::GLOB::BEGIN@22 which was called:
# once (5µs+15µs) by Data::Printer::Object::BEGIN@57 at line 22 # spent 19µs making 1 call to Data::Printer::Filter::GLOB::BEGIN@22
# spent 14µs making 1 call to warnings::unimport |
| 23 | if ($flags) { | ||||
| 24 | $extra .= ($flags & O_WRONLY) ? 'write-only' | ||||
| 25 | : ($flags & O_RDWR) ? 'read/write' | ||||
| 26 | : 'read-only' | ||||
| 27 | ; | ||||
| 28 | |||||
| 29 | # How to avoid croaking when the system | ||||
| 30 | # doesn't implement one of those, without skipping | ||||
| 31 | # the whole thing? Maybe there's a better way. | ||||
| 32 | # Solaris, for example, doesn't have O_ASYNC :( | ||||
| 33 | my %flags = (); | ||||
| 34 | eval { $flags{'append'} = O_APPEND }; | ||||
| 35 | eval { $flags{'async'} = O_ASYNC }; # leont says this is the only one I should care for. | ||||
| 36 | eval { $flags{'create'} = O_CREAT }; | ||||
| 37 | eval { $flags{'truncate'} = O_TRUNC }; | ||||
| 38 | eval { $flags{'nonblocking'} = O_NONBLOCK }; | ||||
| 39 | |||||
| 40 | if (my @flags = grep { $flags & $flags{$_} } sort keys %flags) { | ||||
| 41 | $extra .= ", flags: @flags"; | ||||
| 42 | } | ||||
| 43 | $extra .= ', '; | ||||
| 44 | } | ||||
| 45 | my @layers = (); | ||||
| 46 | # TODO: try PerlIO::Layers::get_layers (leont) | ||||
| 47 | my $error = Data::Printer::Common::_tryme(sub { | ||||
| 48 | @layers = PerlIO::get_layers $$glob | ||||
| 49 | }); | ||||
| 50 | $extra .= "layers: @layers" unless $error; | ||||
| 51 | $string .= " ($extra)" if $extra; | ||||
| 52 | |||||
| 53 | if ($ddp->show_tied and my $tie = ref tied *$$glob) { | ||||
| 54 | $string .= " (tied to $tie)" | ||||
| 55 | } | ||||
| 56 | return $string; | ||||
| 57 | }; | ||||
| 58 | |||||
| 59 | 1 | 2µs | 1; | ||
# spent 300ns within Data::Printer::Filter::GLOB::__ANON__ which was called:
# once (300ns+0s) by Data::Printer::Filter::GLOB::BEGIN@5 at line 5 |