← 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 17:10:45 2013
Reported on Tue Oct 15 17:12:49 2013

Filename/usr/share/perl5/Business/ISBN10.pm
StatementsExecuted 21 statements in 732µs
Subroutines
Calls P F Exclusive
Time
Inclusive
Time
Subroutine
11132µs39µsBusiness::ISBN10::::BEGIN@4Business::ISBN10::BEGIN@4
11121µs154µsBusiness::ISBN10::::BEGIN@5Business::ISBN10::BEGIN@5
11121µs383µsBusiness::ISBN10::::BEGIN@7Business::ISBN10::BEGIN@7
11113µs40µsBusiness::ISBN10::::BEGIN@9Business::ISBN10::BEGIN@9
11112µs60µsBusiness::ISBN10::::BEGIN@25Business::ISBN10::BEGIN@25
11110µs70µ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;
4362µs247µs
# spent 39µs (32+8) within Business::ISBN10::BEGIN@4 which was called: # once (32µs+8µs) by Business::ISBN::BEGIN@132 at line 4
use strict;
# spent 39µs making 1 call to Business::ISBN10::BEGIN@4 # spent 8µs making 1 call to strict::import
5366µs2287µs
# spent 154µs (21+133) within Business::ISBN10::BEGIN@5 which was called: # once (21µs+133µs) by Business::ISBN::BEGIN@132 at line 5
use base qw(Business::ISBN);
# spent 154µs making 1 call to Business::ISBN10::BEGIN@5 # spent 133µs making 1 call to base::import
6
7350µs2746µs
# spent 383µs (21+363) within Business::ISBN10::BEGIN@7 which was called: # once (21µs+363µs) by Business::ISBN::BEGIN@132 at line 7
use Business::ISBN qw(:all);
# spent 383µs making 1 call to Business::ISBN10::BEGIN@7 # spent 363µs making 1 call to Exporter::import
8
917µs127µs
# spent 40µs (13+27) within Business::ISBN10::BEGIN@9 which was called: # once (13µs+27µs) by Business::ISBN::BEGIN@132 at line 16
use subs qw(
# spent 27µ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
16227µs140µs );
# spent 40µs making 1 call to Business::ISBN10::BEGIN@9
17
1816µs160µs
# spent 70µs (10+60) within Business::ISBN10::BEGIN@18 which was called: # once (10µs+60µs) by Business::ISBN::BEGIN@132 at line 23
use vars qw(
# spent 60µs making 1 call to vars::import
19 $VERSION
20 $debug
21 $MAX_GROUP_CODE_LENGTH
22 %ERROR_TEXT
23229µs170µs );
# spent 70µs making 1 call to Business::ISBN10::BEGIN@18
24
253477µs2108µs
# spent 60µs (12+48) within Business::ISBN10::BEGIN@25 which was called: # once (12µs+48µs) by Business::ISBN::BEGIN@132 at line 25
use Carp qw(carp croak cluck);
# spent 60µs making 1 call to Business::ISBN10::BEGIN@25 # spent 48µs making 1 call to Exporter::import
26
2712µsmy $debug = 0;
28
2911µs$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
9515µs1;
96
97__END__