| Filename | /Users/ether/.perlbrew/libs/36.0@std/lib/perl5/YAML/PP/Writer/File.pm |
| Statements | Executed 12 statements in 467µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 35µs | 39µs | YAML::PP::Dumper::BEGIN@1.298 |
| 1 | 1 | 1 | 16µs | 59µs | YAML::PP::Writer::File::BEGIN@7 |
| 1 | 1 | 1 | 13µs | 82µs | YAML::PP::Writer::File::BEGIN@9 |
| 1 | 1 | 1 | 9µs | 50µs | YAML::PP::Dumper::BEGIN@2.299 |
| 1 | 1 | 1 | 8µs | 33µs | YAML::PP::Writer::File::BEGIN@11 |
| 0 | 0 | 0 | 0s | 0s | YAML::PP::Writer::File::_open_handle |
| 0 | 0 | 0 | 0s | 0s | YAML::PP::Writer::File::finish |
| 0 | 0 | 0 | 0s | 0s | YAML::PP::Writer::File::init |
| 0 | 0 | 0 | 0s | 0s | YAML::PP::Writer::File::write |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | 2 | 39µs | 2 | 43µs | # spent 39µs (35+4) within YAML::PP::Dumper::BEGIN@1.298 which was called:
# once (35µs+4µs) by YAML::PP::Dumper::BEGIN@12 at line 1 # spent 39µs making 1 call to YAML::PP::Dumper::BEGIN@1.298
# spent 4µs making 1 call to strict::import |
| 2 | 2 | 58µs | 2 | 91µs | # spent 50µs (9+41) within YAML::PP::Dumper::BEGIN@2.299 which was called:
# once (9µs+41µs) by YAML::PP::Dumper::BEGIN@12 at line 2 # spent 50µs making 1 call to YAML::PP::Dumper::BEGIN@2.299
# spent 41µs making 1 call to warnings::import |
| 3 | package YAML::PP::Writer::File; | ||||
| 4 | |||||
| 5 | 1 | 0s | our $VERSION = '0.035'; # VERSION | ||
| 6 | |||||
| 7 | 2 | 45µs | 2 | 102µs | # spent 59µs (16+43) within YAML::PP::Writer::File::BEGIN@7 which was called:
# once (16µs+43µs) by YAML::PP::Dumper::BEGIN@12 at line 7 # spent 59µs making 1 call to YAML::PP::Writer::File::BEGIN@7
# spent 43µs making 1 call to Exporter::import |
| 8 | |||||
| 9 | 2 | 32µs | 2 | 151µs | # spent 82µs (13+69) within YAML::PP::Writer::File::BEGIN@9 which was called:
# once (13µs+69µs) by YAML::PP::Dumper::BEGIN@12 at line 9 # spent 82µs making 1 call to YAML::PP::Writer::File::BEGIN@9
# spent 69µs making 1 call to base::import |
| 10 | |||||
| 11 | 2 | 290µs | 2 | 58µs | # spent 33µs (8+25) within YAML::PP::Writer::File::BEGIN@11 which was called:
# once (8µs+25µs) by YAML::PP::Dumper::BEGIN@12 at line 11 # spent 33µs making 1 call to YAML::PP::Writer::File::BEGIN@11
# spent 25µs making 1 call to Exporter::import |
| 12 | |||||
| 13 | sub _open_handle { | ||||
| 14 | my ($self) = @_; | ||||
| 15 | if (openhandle($self->{output})) { | ||||
| 16 | $self->{filehandle} = $self->{output}; | ||||
| 17 | return $self->{output}; | ||||
| 18 | } | ||||
| 19 | open my $fh, '>:encoding(UTF-8)', $self->{output} | ||||
| 20 | or croak "Could not open '$self->{output}' for writing: $!"; | ||||
| 21 | $self->{filehandle} = $fh; | ||||
| 22 | return $fh; | ||||
| 23 | } | ||||
| 24 | |||||
| 25 | sub write { | ||||
| 26 | my ($self, $line) = @_; | ||||
| 27 | my $fh = $self->{filehandle}; | ||||
| 28 | print $fh $line; | ||||
| 29 | } | ||||
| 30 | |||||
| 31 | sub init { | ||||
| 32 | my ($self) = @_; | ||||
| 33 | my $fh = $self->_open_handle; | ||||
| 34 | } | ||||
| 35 | |||||
| 36 | sub finish { | ||||
| 37 | my ($self) = @_; | ||||
| 38 | if (openhandle($self->{output})) { | ||||
| 39 | # Original argument was a file handle, so the caller needs | ||||
| 40 | # to close it | ||||
| 41 | return; | ||||
| 42 | } | ||||
| 43 | close $self->{filehandle}; | ||||
| 44 | } | ||||
| 45 | |||||
| 46 | 1 | 3µs | 1; | ||
| 47 | |||||
| 48 | __END__ |