Filename | /usr/share/perl5/MARC/File/Encode.pm |
Statements | Executed 10 statements in 139µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 11µs | 25µs | BEGIN@19 | MARC::File::Encode::
1 | 1 | 1 | 8µs | 54µs | BEGIN@22 | MARC::File::Encode::
1 | 1 | 1 | 7µs | 61µs | BEGIN@21 | MARC::File::Encode::
1 | 1 | 1 | 7µs | 11µs | BEGIN@20 | MARC::File::Encode::
0 | 0 | 0 | 0s | 0s | marc_to_utf8 | MARC::File::Encode::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package MARC::File::Encode; | ||||
2 | |||||
3 | =head1 NAME | ||||
4 | |||||
5 | MARC::File::Encode - Encode wrapper for MARC::Record | ||||
6 | |||||
7 | =head1 DESCRIPTION | ||||
8 | |||||
9 | Encode.pm exports encode() by default, and MARC::File::USMARC | ||||
10 | already has a function encode() so we need this wrapper to | ||||
11 | keep things the way they are. I was half tempted to change | ||||
12 | MARC::File::USMARC::encode() to something else but there could | ||||
13 | very well be code in the wild that uses it directly and I don't | ||||
14 | want to break backwards compat. This probably comes with a performance | ||||
15 | hit of some kind. | ||||
16 | |||||
17 | =cut | ||||
18 | |||||
19 | 2 | 24µs | 2 | 38µs | # spent 25µs (11+14) within MARC::File::Encode::BEGIN@19 which was called:
# once (11µs+14µs) by MARC::File::USMARC::BEGIN@14 at line 19 # spent 25µs making 1 call to MARC::File::Encode::BEGIN@19
# spent 14µs making 1 call to strict::import |
20 | 2 | 21µs | 2 | 15µs | # spent 11µs (7+4) within MARC::File::Encode::BEGIN@20 which was called:
# once (7µs+4µs) by MARC::File::USMARC::BEGIN@14 at line 20 # spent 11µs making 1 call to MARC::File::Encode::BEGIN@20
# spent 4µs making 1 call to warnings::import |
21 | 2 | 27µs | 2 | 115µs | # spent 61µs (7+54) within MARC::File::Encode::BEGIN@21 which was called:
# once (7µs+54µs) by MARC::File::USMARC::BEGIN@14 at line 21 # spent 61µs making 1 call to MARC::File::Encode::BEGIN@21
# spent 54µs making 1 call to base::import |
22 | 2 | 64µs | 2 | 99µs | # spent 54µs (8+45) within MARC::File::Encode::BEGIN@22 which was called:
# once (8µs+45µs) by MARC::File::USMARC::BEGIN@14 at line 22 # spent 54µs making 1 call to MARC::File::Encode::BEGIN@22
# spent 45µs making 1 call to Exporter::import |
23 | |||||
24 | 1 | 900ns | our @EXPORT_OK = qw( marc_to_utf8 ); | ||
25 | |||||
26 | =head2 marc_to_utf8() | ||||
27 | |||||
28 | Simple wrapper around Encode::decode(). | ||||
29 | |||||
30 | =cut | ||||
31 | |||||
32 | sub marc_to_utf8 { | ||||
33 | # if there is invalid utf8 date then this will through an exception | ||||
34 | # let's just hope it's valid :-) | ||||
35 | return decode( 'UTF-8', $_[0], 1 ); | ||||
36 | } | ||||
37 | |||||
38 | 1 | 2µs | 1; |