| Filename | /usr/share/perl/5.18/locale.pm |
| Statements | Executed 17 statements in 153µs |
| Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
|---|---|---|---|---|---|
| 2 | 2 | 1 | 19µs | 66µs | locale::import |
| 1 | 1 | 1 | 14µs | 25µs | locale::BEGIN@4 |
| 0 | 0 | 0 | 0s | 0s | locale::unimport |
| Line | State ments |
Time on line |
Calls | Time in subs |
Code |
|---|---|---|---|---|---|
| 1 | package locale; | ||||
| 2 | |||||
| 3 | 1 | 300ns | our $VERSION = '1.02'; | ||
| 4 | 2 | 133µs | 2 | 36µs | # spent 25µs (14+11) within locale::BEGIN@4 which was called:
# once (14µs+11µs) by DBD::SQLite::BEGIN@26 at line 4 # spent 25µs making 1 call to locale::BEGIN@4
# spent 11µs making 1 call to Config::import |
| 5 | |||||
| 6 | 1 | 600ns | $Carp::Internal{ (__PACKAGE__) } = 1; | ||
| 7 | |||||
| 8 | # A separate bit is used for each of the two forms of the pragma, as they are | ||||
| 9 | # mostly independent, and interact with each other and the unicode_strings | ||||
| 10 | # feature. This allows for fast determination of which one(s) of the three | ||||
| 11 | # are to be used at any given point, and no code has to be written to deal | ||||
| 12 | # with coming in and out of scopes--it falls automatically out from the hint | ||||
| 13 | # handling | ||||
| 14 | |||||
| 15 | 1 | 100ns | $locale::hint_bits = 0x4; | ||
| 16 | 1 | 100ns | $locale::not_chars_hint_bits = 0x10; | ||
| 17 | |||||
| 18 | # spent 66µs (19+47) within locale::import which was called 2 times, avg 33µs/call:
# once (11µs+44µs) by DBD::SQLite::BEGIN@26 at line 26 of DBD/SQLite.pm
# once (8µs+3µs) by DBD::SQLite::dr::BEGIN@185 at line 185 of DBD/SQLite.pm | ||||
| 19 | 2 | 200ns | shift; # should be 'locale'; not checked | ||
| 20 | |||||
| 21 | 2 | 8µs | 2 | 47µs | if(!$Config{d_setlocale}) { # spent 47µs making 2 calls to Config::FETCH, avg 23µs/call |
| 22 | ## No locale support found on this Perl, giving up: | ||||
| 23 | die('Your vendor does not support locales, you cannot use the locale module.'); | ||||
| 24 | } | ||||
| 25 | |||||
| 26 | 2 | 400ns | my $found_not_chars = 0; | ||
| 27 | 2 | 1µs | while (defined (my $arg = shift)) { | ||
| 28 | if ($arg eq ":not_characters") { | ||||
| 29 | $^H |= $locale::not_chars_hint_bits; | ||||
| 30 | |||||
| 31 | # This form of the pragma overrides the other | ||||
| 32 | $^H &= ~$locale::hint_bits; | ||||
| 33 | $found_not_chars = 1; | ||||
| 34 | } | ||||
| 35 | else { | ||||
| 36 | require Carp; | ||||
| 37 | Carp::croak("Unknown parameter '$arg' to 'use locale'"); | ||||
| 38 | } | ||||
| 39 | } | ||||
| 40 | |||||
| 41 | # Use the plain form if not doing the :not_characters one. | ||||
| 42 | 2 | 7µs | $^H |= $locale::hint_bits unless $found_not_chars; | ||
| 43 | } | ||||
| 44 | |||||
| 45 | sub unimport { | ||||
| 46 | $^H &= ~($locale::hint_bits|$locale::not_chars_hint_bits); | ||||
| 47 | } | ||||
| 48 | |||||
| 49 | 1 | 2µs | 1; |