Filename | /usr/lib/x86_64-linux-gnu/perl5/5.20/YAML/Syck.pm |
Statements | Executed 26 statements in 1.42ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 151µs | 151µs | LoadYAML (xsub) | YAML::Syck::
1 | 1 | 1 | 62µs | 62µs | DumpYAML (xsub) | YAML::Syck::
1 | 1 | 1 | 27µs | 68µs | BEGIN@38 | YAML::Syck::
1 | 1 | 1 | 20µs | 210µs | BEGIN@16 | YAML::Syck::
1 | 1 | 1 | 14µs | 166µs | Load | YAML::Syck::
1 | 1 | 1 | 14µs | 14µs | BEGIN@13 | YAML::Syck::
1 | 1 | 1 | 12µs | 23µs | BEGIN@5 | YAML::Syck::
1 | 1 | 1 | 9µs | 22µs | BEGIN@14 | YAML::Syck::
1 | 1 | 1 | 8µs | 132µs | BEGIN@6 | YAML::Syck::
1 | 1 | 1 | 7µs | 69µs | Dump | YAML::Syck::
0 | 0 | 0 | 0s | 0s | DumpFile | YAML::Syck::
0 | 0 | 0 | 0s | 0s | DumpInto | YAML::Syck::
0 | 0 | 0 | 0s | 0s | LoadFile | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:39] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:40] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:41] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:42] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:43] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:44] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:45] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:46] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:47] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:48] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:49] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:50] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:51] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:52] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:53] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __ANON__[:54] | YAML::Syck::
0 | 0 | 0 | 0s | 0s | __qr_helper | YAML::Syck::
0 | 0 | 0 | 0s | 0s | _is_glob | YAML::Syck::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package YAML::Syck; | ||||
2 | |||||
3 | # See documentation after the __END__ mark. | ||||
4 | |||||
5 | 2 | 38µs | 2 | 34µs | # spent 23µs (12+11) within YAML::Syck::BEGIN@5 which was called:
# once (12µs+11µs) by C4::Message::BEGIN@26 at line 5 # spent 23µs making 1 call to YAML::Syck::BEGIN@5
# spent 11µs making 1 call to strict::import |
6 | 1 | 5µs | 1 | 124µs | # spent 132µs (8+124) within YAML::Syck::BEGIN@6 which was called:
# once (8µs+124µs) by C4::Message::BEGIN@26 at line 12 # spent 124µs making 1 call to vars::import |
7 | @ISA @EXPORT @EXPORT_OK $VERSION | ||||
8 | $Headless $SortKeys $SingleQuote | ||||
9 | $ImplicitBinary $ImplicitTyping $ImplicitUnicode | ||||
10 | $UseCode $LoadCode $DumpCode | ||||
11 | $DeparseObject $LoadBlessed | ||||
12 | 1 | 19µs | 1 | 132µs | ); # spent 132µs making 1 call to YAML::Syck::BEGIN@6 |
13 | 2 | 40µs | 1 | 14µs | # spent 14µs within YAML::Syck::BEGIN@13 which was called:
# once (14µs+0s) by C4::Message::BEGIN@26 at line 13 # spent 14µs making 1 call to YAML::Syck::BEGIN@13 |
14 | 2 | 95µs | 2 | 36µs | # spent 22µs (9+14) within YAML::Syck::BEGIN@14 which was called:
# once (9µs+14µs) by C4::Message::BEGIN@26 at line 14 # spent 22µs making 1 call to YAML::Syck::BEGIN@14
# spent 14µs making 1 call to Exporter::import |
15 | |||||
16 | # spent 210µs (20+190) within YAML::Syck::BEGIN@16 which was called:
# once (20µs+190µs) by C4::Message::BEGIN@26 at line 36 | ||||
17 | 1 | 300ns | $VERSION = '1.27'; | ||
18 | 1 | 700ns | @EXPORT = qw( Dump Load DumpFile LoadFile ); | ||
19 | 1 | 200ns | @EXPORT_OK = qw( DumpInto ); | ||
20 | 1 | 5µs | @ISA = qw( Exporter ); | ||
21 | |||||
22 | 1 | 200ns | $SortKeys = 1; | ||
23 | 1 | 100ns | $LoadBlessed = 1; | ||
24 | |||||
25 | 1 | 300ns | local $@; | ||
26 | eval { | ||||
27 | 1 | 1µs | require XSLoader; | ||
28 | 1 | 197µs | 1 | 190µs | XSLoader::load( __PACKAGE__, $VERSION ); # spent 190µs making 1 call to XSLoader::load |
29 | 1 | 600ns | 1; | ||
30 | 1 | 3µs | } or do { | ||
31 | require DynaLoader; | ||||
32 | push @ISA, 'DynaLoader'; | ||||
33 | __PACKAGE__->bootstrap($VERSION); | ||||
34 | }; | ||||
35 | |||||
36 | 1 | 282µs | 1 | 210µs | } # spent 210µs making 1 call to YAML::Syck::BEGIN@16 |
37 | |||||
38 | # spent 68µs (27+41) within YAML::Syck::BEGIN@38 which was called:
# once (27µs+41µs) by C4::Message::BEGIN@26 at line 55 | ||||
39 | '' => sub { qr{$_[0]} }, | ||||
40 | x => sub { qr{$_[0]}x }, | ||||
41 | i => sub { qr{$_[0]}i }, | ||||
42 | s => sub { qr{$_[0]}s }, | ||||
43 | m => sub { qr{$_[0]}m }, | ||||
44 | ix => sub { qr{$_[0]}ix }, | ||||
45 | sx => sub { qr{$_[0]}sx }, | ||||
46 | mx => sub { qr{$_[0]}mx }, | ||||
47 | si => sub { qr{$_[0]}si }, | ||||
48 | mi => sub { qr{$_[0]}mi }, | ||||
49 | ms => sub { qr{$_[0]}sm }, | ||||
50 | six => sub { qr{$_[0]}six }, | ||||
51 | mix => sub { qr{$_[0]}mix }, | ||||
52 | msx => sub { qr{$_[0]}msx }, | ||||
53 | msi => sub { qr{$_[0]}msi }, | ||||
54 | msix => sub { qr{$_[0]}msix }, | ||||
55 | 2 | 492µs | 2 | 110µs | }; # spent 68µs making 1 call to YAML::Syck::BEGIN@38
# spent 41µs making 1 call to constant::import |
56 | |||||
57 | sub __qr_helper { | ||||
58 | if ( $_[0] =~ /\A \(\? ([ixsm]*) (?:- (?:[ixsm]*))? : (.*) \) \z/x ) { | ||||
59 | my $sub = QR_MAP()->{$1} || QR_MAP()->{''}; | ||||
60 | &$sub($2); | ||||
61 | } | ||||
62 | else { | ||||
63 | qr/$_[0]/; | ||||
64 | } | ||||
65 | } | ||||
66 | |||||
67 | # spent 69µs (7+62) within YAML::Syck::Dump which was called:
# once (7µs+62µs) by CGI::Session::Serialize::yaml::freeze at line 18 of CGI/Session/Serialize/yaml.pm | ||||
68 | $#_ | ||||
69 | 1 | 70µs | 1 | 62µs | ? join( '', map { YAML::Syck::DumpYAML($_) } @_ ) # spent 62µs making 1 call to YAML::Syck::DumpYAML |
70 | : YAML::Syck::DumpYAML( $_[0] ); | ||||
71 | } | ||||
72 | |||||
73 | # spent 166µs (14+151) within YAML::Syck::Load which was called:
# once (14µs+151µs) by CGI::Session::Serialize::yaml::thaw at line 24 of CGI/Session/Serialize/yaml.pm | ||||
74 | 1 | 6µs | if (wantarray) { | ||
75 | 1 | 161µs | 1 | 151µs | my ($rv) = YAML::Syck::LoadYAML( $_[0] ); # spent 151µs making 1 call to YAML::Syck::LoadYAML |
76 | 1 | 1µs | @{$rv}; | ||
77 | } | ||||
78 | else { | ||||
79 | @_ = $_[0]; | ||||
80 | goto &YAML::Syck::LoadYAML; | ||||
81 | } | ||||
82 | } | ||||
83 | |||||
84 | sub _is_glob { | ||||
85 | my $h = shift; | ||||
86 | |||||
87 | return 1 if ( ref($h) eq 'GLOB' ); | ||||
88 | return 1 if ( ref( \$h ) eq 'GLOB' ); | ||||
89 | return 1 if ( ref($h) =~ m/^IO::/ ); | ||||
90 | |||||
91 | return; | ||||
92 | } | ||||
93 | |||||
94 | sub DumpFile { | ||||
95 | my $file = shift; | ||||
96 | if ( _is_glob($file) ) { | ||||
97 | for (@_) { | ||||
98 | my $err = YAML::Syck::DumpYAMLFile( $_, $file ); | ||||
99 | if ($err) { | ||||
100 | $! = 0 + $err; | ||||
101 | die "Error writing to filehandle $file: $!\n"; | ||||
102 | } | ||||
103 | } | ||||
104 | } | ||||
105 | else { | ||||
106 | open( my $fh, '>', $file ) or die "Cannot write to $file: $!"; | ||||
107 | for (@_) { | ||||
108 | my $err = YAML::Syck::DumpYAMLFile( $_, $fh ); | ||||
109 | if ($err) { | ||||
110 | $! = 0 + $err; | ||||
111 | die "Error writing to file $file: $!\n"; | ||||
112 | } | ||||
113 | } | ||||
114 | close $fh | ||||
115 | or die "Error writing to file $file: $!\n"; | ||||
116 | } | ||||
117 | return 1; | ||||
118 | } | ||||
119 | |||||
120 | sub LoadFile { | ||||
121 | my $file = shift; | ||||
122 | if ( _is_glob($file) ) { | ||||
123 | Load( | ||||
124 | do { local $/; <$file> } | ||||
125 | ); | ||||
126 | } | ||||
127 | else { | ||||
128 | if ( !-e $file || -z $file ) { | ||||
129 | die("'$file' is empty or non-existent"); | ||||
130 | } | ||||
131 | open( my $fh, '<', $file ) or die "Cannot read from $file: $!"; | ||||
132 | Load( | ||||
133 | do { local $/; <$fh> } | ||||
134 | ); | ||||
135 | } | ||||
136 | } | ||||
137 | |||||
138 | sub DumpInto { | ||||
139 | my $bufref = shift; | ||||
140 | ( ref $bufref ) or die "DumpInto not given reference to output buffer\n"; | ||||
141 | YAML::Syck::DumpYAMLInto( $_, $bufref ) for @_; | ||||
142 | 1; | ||||
143 | } | ||||
144 | |||||
145 | 1 | 2µs | 1; | ||
146 | |||||
147 | __END__ | ||||
# spent 62µs within YAML::Syck::DumpYAML which was called:
# once (62µs+0s) by YAML::Syck::Dump at line 69 | |||||
# spent 151µs within YAML::Syck::LoadYAML which was called:
# once (151µs+0s) by YAML::Syck::Load at line 75 |