← Index
NYTProf Performance Profile   « block view • line view • sub view »
For /usr/share/koha/opac/cgi-bin/opac/opac-search.pl
  Run on Tue Oct 15 11:58:52 2013
Reported on Tue Oct 15 12:01:07 2013

Filename/usr/share/perl5/Business/ISBN10.pm
StatementsExecuted 21 statements in 599µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11123µs31µsBusiness::ISBN10::::BEGIN@4Business::ISBN10::BEGIN@4
11117µs333µsBusiness::ISBN10::::BEGIN@7Business::ISBN10::BEGIN@7
11114µs43µsBusiness::ISBN10::::BEGIN@9Business::ISBN10::BEGIN@9
11113µs140µsBusiness::ISBN10::::BEGIN@5Business::ISBN10::BEGIN@5
11113µs73µsBusiness::ISBN10::::BEGIN@25Business::ISBN10::BEGIN@25
11112µs81µsBusiness::ISBN10::::BEGIN@18Business::ISBN10::BEGIN@18
0000s0sBusiness::ISBN10::::_checksumBusiness::ISBN10::_checksum
0000s0sBusiness::ISBN10::::_hyphen_positionsBusiness::ISBN10::_hyphen_positions
0000s0sBusiness::ISBN10::::_max_lengthBusiness::ISBN10::_max_length
0000s0sBusiness::ISBN10::::_parse_prefixBusiness::ISBN10::_parse_prefix
0000s0sBusiness::ISBN10::::_set_prefixBusiness::ISBN10::_set_prefix
0000s0sBusiness::ISBN10::::_set_typeBusiness::ISBN10::_set_type
0000s0sBusiness::ISBN10::::as_isbn10Business::ISBN10::as_isbn10
0000s0sBusiness::ISBN10::::as_isbn13Business::ISBN10::as_isbn13
Call graph for these subroutines as a Graphviz dot language file.
Line State
ments
Time
on line
Calls Time
in subs
Code
1# $Revision: 2.4 $
2# $Id: ISBN10.pm,v 2.4 2007/08/13 03:15:22 comdog Exp $
3package Business::ISBN10;
4336µs239µs
# spent 31µs (23+8) within Business::ISBN10::BEGIN@4 which was called: # once (23µs+8µs) by Business::ISBN::BEGIN@132 at line 4
use strict;
# spent 31µs making 1 call to Business::ISBN10::BEGIN@4 # spent 8µs making 1 call to strict::import
5343µs2267µs
# spent 140µs (13+127) within Business::ISBN10::BEGIN@5 which was called: # once (13µs+127µs) by Business::ISBN::BEGIN@132 at line 5
use base qw(Business::ISBN);
# spent 140µs making 1 call to Business::ISBN10::BEGIN@5 # spent 127µs making 1 call to base::import
6
7350µs2649µs
# spent 333µs (17+316) within Business::ISBN10::BEGIN@7 which was called: # once (17µs+316µs) by Business::ISBN::BEGIN@132 at line 7
use Business::ISBN qw(:all);
# spent 333µs making 1 call to Business::ISBN10::BEGIN@7 # spent 316µs making 1 call to Exporter::import
8
9129µs
# spent 43µs (14+29) within Business::ISBN10::BEGIN@9 which was called: # once (14µs+29µs) by Business::ISBN::BEGIN@132 at line 16
use subs qw(
# spent 29µs making 1 call to subs::import
10 _checksum
11 INVALID_GROUP_CODE
12 INVALID_PUBLISHER_CODE
13 BAD_CHECKSUM
14 GOOD_ISBN
15 BAD_ISBN
16343µs143µs );
# spent 43µs making 1 call to Business::ISBN10::BEGIN@9
17
18169µs
# spent 81µs (12+69) within Business::ISBN10::BEGIN@18 which was called: # once (12µs+69µs) by Business::ISBN::BEGIN@132 at line 23
use vars qw(
# spent 69µs making 1 call to vars::import
19 $VERSION
20 $debug
21 $MAX_GROUP_CODE_LENGTH
22 %ERROR_TEXT
23338µs181µs );
# spent 81µs making 1 call to Business::ISBN10::BEGIN@18
24
253384µs2132µs
# spent 73µs (13+59) within Business::ISBN10::BEGIN@25 which was called: # once (13µs+59µs) by Business::ISBN::BEGIN@132 at line 25
use Carp qw(carp croak cluck);
# spent 73µs making 1 call to Business::ISBN10::BEGIN@25 # spent 59µs making 1 call to Exporter::import
26
271600nsmy $debug = 0;
28
291500ns$VERSION = '2.05';
30
31sub _max_length { 10 }
32
33sub _set_type { $_[0]->{type} = 'ISBN10' }
34
35sub _parse_prefix { '' }
36sub _set_prefix
37 {
38 croak "Cannot set prefix [$_[1]] on an ISBN-10" if length $_[1];
39
40 $_[0]->{prefix} = $_[1];
41 }
42
43sub _hyphen_positions {
44 [
45 $_[0]->_group_code_length,
46 $_[0]->_group_code_length + $_[0]->_publisher_code_length,
47 9
48 ]
49 }
50
51sub as_isbn10
52 {
53 my $self = shift;
54
55 my $isbn10 = Business::ISBN->new( $self->isbn );
56 $isbn10->fix_checksum;
57
58 return $isbn10;
59 }
60
61sub as_isbn13
62 {
63 my $self = shift;
64
65 my $isbn13 = Business::ISBN->new( '978' . $self->isbn );
66 $isbn13->fix_checksum;
67
68 return $isbn13;
69 }
70
71#internal function. you don't get to use this one.
72sub _checksum
73 {
74 my $data = $_[0]->isbn;
75
76 return unless defined $data;
77
78 my @digits = split //, $data;
79 my $sum = 0;
80
81 foreach( reverse 2..10 )
82 {
83 $sum += $_ * (shift @digits);
84 }
85
86 #return what the check digit should be
87 my $checksum = (11 - ($sum % 11))%11;
88
89 $checksum = 'X' if $checksum == 10;
90
91 return $checksum;
92 }
93
94
9514µs1;
96
97__END__