Filename | /mnt/catalyst/koha/C4/ClassSortRoutine/Generic.pm |
Statements | Executed 17 statements in 340µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 739µs | 752µs | BEGIN@20 | C4::ClassSortRoutine::Generic::
1 | 1 | 1 | 15µs | 20µs | get_class_sort_key | C4::ClassSortRoutine::Generic::
1 | 1 | 1 | 8µs | 14µs | BEGIN@21 | C4::ClassSortRoutine::Generic::
1 | 1 | 1 | 7µs | 26µs | BEGIN@23 | C4::ClassSortRoutine::Generic::
4 | 4 | 1 | 5µs | 5µs | CORE:subst (opcode) | C4::ClassSortRoutine::Generic::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package C4::ClassSortRoutine::Generic; | ||||
2 | |||||
3 | # Copyright (C) 2007 LibLime | ||||
4 | # | ||||
5 | # This file is part of Koha. | ||||
6 | # | ||||
7 | # Koha is free software; you can redistribute it and/or modify it under the | ||||
8 | # terms of the GNU General Public License as published by the Free Software | ||||
9 | # Foundation; either version 2 of the License, or (at your option) any later | ||||
10 | # version. | ||||
11 | # | ||||
12 | # Koha is distributed in the hope that it will be useful, but WITHOUT ANY | ||||
13 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR | ||||
14 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||||
15 | # | ||||
16 | # You should have received a copy of the GNU General Public License along | ||||
17 | # with Koha; if not, write to the Free Software Foundation, Inc., | ||||
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||||
19 | |||||
20 | 2 | 30µs | 2 | 766µs | # spent 752µs (739+14) within C4::ClassSortRoutine::Generic::BEGIN@20 which was called:
# once (739µs+14µs) by C4::ClassSource::BEGIN@25 at line 20 # spent 752µs making 1 call to C4::ClassSortRoutine::Generic::BEGIN@20
# spent 14µs making 1 call to strict::import |
21 | 2 | 25µs | 2 | 19µs | # spent 14µs (8+5) within C4::ClassSortRoutine::Generic::BEGIN@21 which was called:
# once (8µs+5µs) by C4::ClassSource::BEGIN@25 at line 21 # spent 14µs making 1 call to C4::ClassSortRoutine::Generic::BEGIN@21
# spent 5µs making 1 call to warnings::import |
22 | |||||
23 | 2 | 96µs | 2 | 45µs | # spent 26µs (7+19) within C4::ClassSortRoutine::Generic::BEGIN@23 which was called:
# once (7µs+19µs) by C4::ClassSource::BEGIN@25 at line 23 # spent 26µs making 1 call to C4::ClassSortRoutine::Generic::BEGIN@23
# spent 19µs making 1 call to vars::import |
24 | |||||
25 | # set the version for version checking | ||||
26 | 1 | 1µs | $VERSION = 3.07.00.049; | ||
27 | |||||
28 | =head1 NAME | ||||
29 | |||||
30 | C4::ClassSortRoutine::Generic - generic call number sorting key routine | ||||
31 | |||||
32 | =head1 SYNOPSIS | ||||
33 | |||||
34 | use C4::ClassSortRoutine; | ||||
35 | |||||
36 | my $cn_sort = GetClassSortKey('Generic', $cn_class, $cn_item); | ||||
37 | |||||
38 | =head1 FUNCTIONS | ||||
39 | |||||
40 | =head2 get_class_sort_key | ||||
41 | |||||
42 | my $cn_sort = C4::ClassSortRoutine::Generic::Generic($cn_class, $cn_item); | ||||
43 | |||||
44 | Generates sorting key using the following rules: | ||||
45 | |||||
46 | * Concatenates class and item part. | ||||
47 | * Removes leading and trailing whitespace. | ||||
48 | * Converts each run of whitespace to an underscore. | ||||
49 | * Converts to upper-case and removes non-alphabetical, non-numeric, non-underscore characters. | ||||
50 | |||||
51 | =cut | ||||
52 | |||||
53 | # spent 20µs (15+5) within C4::ClassSortRoutine::Generic::get_class_sort_key which was called:
# once (15µs+5µs) by C4::ClassSource::BEGIN@25 at line 1 of (eval 43)[C4/ClassSortRoutine.pm:58] | ||||
54 | 1 | 600ns | my ($cn_class, $cn_item) = @_; | ||
55 | |||||
56 | 1 | 200ns | $cn_class = '' unless defined $cn_class; | ||
57 | 1 | 100ns | $cn_item = '' unless defined $cn_item; | ||
58 | 1 | 800ns | my $key = uc "$cn_class $cn_item"; | ||
59 | 1 | 6µs | 1 | 2µs | $key =~ s/^\s+//; # spent 2µs making 1 call to C4::ClassSortRoutine::Generic::CORE:subst |
60 | 1 | 4µs | 1 | 1µs | $key =~ s/\s+$//; # spent 1µs making 1 call to C4::ClassSortRoutine::Generic::CORE:subst |
61 | 1 | 4µs | 1 | 2µs | $key =~ s/\s+/_/g; # spent 2µs making 1 call to C4::ClassSortRoutine::Generic::CORE:subst |
62 | 1 | 165µs | 2 | 56µs | $key =~ s/[^\p{IsAlnum}_]//g; # spent 55µs making 1 call to utf8::SWASHNEW
# spent 500ns making 1 call to C4::ClassSortRoutine::Generic::CORE:subst |
63 | 1 | 4µs | return $key; | ||
64 | |||||
65 | } | ||||
66 | |||||
67 | 1 | 3µs | 1; | ||
68 | |||||
69 | =head1 AUTHOR | ||||
70 | |||||
71 | Koha Development Team <http://koha-community.org/> | ||||
72 | |||||
73 | =cut | ||||
74 | |||||
# spent 5µs within C4::ClassSortRoutine::Generic::CORE:subst which was called 4 times, avg 1µs/call:
# once (2µs+0s) by C4::ClassSortRoutine::Generic::get_class_sort_key at line 61
# once (2µs+0s) by C4::ClassSortRoutine::Generic::get_class_sort_key at line 59
# once (1µs+0s) by C4::ClassSortRoutine::Generic::get_class_sort_key at line 60
# once (500ns+0s) by C4::ClassSortRoutine::Generic::get_class_sort_key at line 62 |