| 1 | ############################################################################### | ||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||
| 3 | # This file copyright (c) 2006-2008 by Randy J. Ray, all rights reserved | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # See "LICENSE" in the documentation for licensing and redistribution terms. | ||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||
| 7 | ############################################################################### | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | # $Id: Books.pm 48 2008-04-06 10:38:11Z $ | ||||||||||||||||||||||||||||
| 10 | # | ||||||||||||||||||||||||||||
| 11 | # Description: Specialization of the API class for book data. | ||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||
| 13 | # Functions: BUILD | ||||||||||||||||||||||||||||
| 14 | # copy | ||||||||||||||||||||||||||||
| 15 | # find | ||||||||||||||||||||||||||||
| 16 | # get_authors | ||||||||||||||||||||||||||||
| 17 | # set_authors | ||||||||||||||||||||||||||||
| 18 | # get_subjects | ||||||||||||||||||||||||||||
| 19 | # set_subjects | ||||||||||||||||||||||||||||
| 20 | # new | ||||||||||||||||||||||||||||
| 21 | # set_id | ||||||||||||||||||||||||||||
| 22 | # set_isbn | ||||||||||||||||||||||||||||
| 23 | # get_publisher | ||||||||||||||||||||||||||||
| 24 | # normalize_args | ||||||||||||||||||||||||||||
| 25 | # set_change_time | ||||||||||||||||||||||||||||
| 26 | # set_change_time_sec | ||||||||||||||||||||||||||||
| 27 | # set_price_time | ||||||||||||||||||||||||||||
| 28 | # set_price_time_sec | ||||||||||||||||||||||||||||
| 29 | # set_prices | ||||||||||||||||||||||||||||
| 30 | # set_marc | ||||||||||||||||||||||||||||
| 31 | # | ||||||||||||||||||||||||||||
| 32 | # Libraries: Class::Std | ||||||||||||||||||||||||||||
| 33 | # Error | ||||||||||||||||||||||||||||
| 34 | # Business::ISBN | ||||||||||||||||||||||||||||
| 35 | # WebService::ISBNDB::API | ||||||||||||||||||||||||||||
| 36 | # | ||||||||||||||||||||||||||||
| 37 | # Global Consts: $VERSION | ||||||||||||||||||||||||||||
| 38 | # | ||||||||||||||||||||||||||||
| 39 | ############################################################################### | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | package WebService::ISBNDB::API::Books; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 4 | ▶ | use 5.006; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 44 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 45 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 4 | ▶ | no warnings 'redefine'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 47 | 4 | ▶ | use vars qw($VERSION $CAN_PARSE_DATES); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 48 | 4 | ▶ | use base 'WebService::ISBNDB::API'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 4 | ▶ | use Class::Std; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | 4 | ▶ | use Error; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | 4 | ▶ | use Business::ISBN; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | 4 | $VERSION = "0.33"; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | BEGIN | ||||||||||||||||||||||||||||
| 57 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 58 | 4 | ▶ | eval "use Date::Parse"; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 59 | 4 | ▶ | $CAN_PARSE_DATES = ($@) ? 0 : 1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 60 | } | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | # Attributes for the Books class | ||||||||||||||||||||||||||||
| 63 | 4 | my %id : ATTR(:get<id> :init_arg<id> :default<>); | |||||||||||||||||||||||||||
| 64 | 4 | my %isbn : ATTR(:get<isbn> :init_arg<isbn> :default<>); | |||||||||||||||||||||||||||
| 65 | 4 | my %title : ATTR(:name<title> :default<>); | |||||||||||||||||||||||||||
| 66 | 4 | my %longtitle : ATTR(:name<longtitle> :default<>); | |||||||||||||||||||||||||||
| 67 | 4 | my %authors_text : ATTR(:name<authors_text> :default<>); | |||||||||||||||||||||||||||
| 68 | 4 | my %authors : ATTR(:init_arg<authors> :default<>); | |||||||||||||||||||||||||||
| 69 | 4 | my %publisher_text : ATTR(:name<publisher_text> :default<>); | |||||||||||||||||||||||||||
| 70 | 4 | my %publisher : ATTR(:init_arg<publisher> :set<publisher> :default<>); | |||||||||||||||||||||||||||
| 71 | 4 | my %subjects : ATTR(:init_arg<subjects> :default<>); | |||||||||||||||||||||||||||
| 72 | 4 | my %dewey_decimal : ATTR(:name<dewey_decimal> :default<>); | |||||||||||||||||||||||||||
| 73 | 4 | my %dewey_decimal_normalized : ATTR(:name<dewey_decimal_normalized> :default<>); | |||||||||||||||||||||||||||
| 74 | 4 | my %lcc_number : ATTR(:name<lcc_number> :default<>); | |||||||||||||||||||||||||||
| 75 | 4 | my %language : ATTR(:name<language> :default<>); | |||||||||||||||||||||||||||
| 76 | 4 | my %physical_description_text : ATTR(:name<physical_description_text> :default<>); | |||||||||||||||||||||||||||
| 77 | 4 | my %edition_info : ATTR(:name<edition_info> :default<>); | |||||||||||||||||||||||||||
| 78 | 4 | my %change_time : ATTR(:init_arg<change_time> :get<change_time> :default<>); | |||||||||||||||||||||||||||
| 79 | 4 | my %change_time_sec : ATTR(:init_arg<change_time_sec> :get<change_time_sec> :default<>); | |||||||||||||||||||||||||||
| 80 | 4 | my %price_time : ATTR(:init_arg<price_time> :get<price_time> :default<>); | |||||||||||||||||||||||||||
| 81 | 4 | my %price_time_sec : ATTR(:init_arg<price_time_sec> :get<price_time_sec> :default<>); | |||||||||||||||||||||||||||
| 82 | 4 | my %summary : ATTR(:name<summary> :default<>); | |||||||||||||||||||||||||||
| 83 | 4 | my %notes : ATTR(:name<notes> :default<>); | |||||||||||||||||||||||||||
| 84 | 4 | my %urlstext : ATTR(:name<urlstext> :default<>); | |||||||||||||||||||||||||||
| 85 | 4 | my %awardstext : ATTR(:name<awardstext> :default<>); | |||||||||||||||||||||||||||
| 86 | 4 | my %prices : ATTR(:init_arg<prices> :get<prices> :default<>); | |||||||||||||||||||||||||||
| 87 | 4 | my %marc : ATTR(:init_arg<marc> :get<marc> :default<>); | |||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | ############################################################################### | ||||||||||||||||||||||||||||
| 90 | # | ||||||||||||||||||||||||||||
| 91 | # Sub Name: new | ||||||||||||||||||||||||||||
| 92 | # | ||||||||||||||||||||||||||||
| 93 | # Description: Pass off to the super-class constructor, which handles | ||||||||||||||||||||||||||||
| 94 | # the special cases for arguments. | ||||||||||||||||||||||||||||
| 95 | # | ||||||||||||||||||||||||||||
| 96 | ############################################################################### | ||||||||||||||||||||||||||||
| 97 | sub new | ||||||||||||||||||||||||||||
| 98 | 747 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 99 | 747 | shift->SUPER::new(@_); | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||
| 102 | ############################################################################### | ||||||||||||||||||||||||||||
| 103 | # | ||||||||||||||||||||||||||||
| 104 | # Sub Name: BUILD | ||||||||||||||||||||||||||||
| 105 | # | ||||||||||||||||||||||||||||
| 106 | # Description: Builder for this class. See Class::Std. | ||||||||||||||||||||||||||||
| 107 | # | ||||||||||||||||||||||||||||
| 108 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 109 | # $self in ref Object | ||||||||||||||||||||||||||||
| 110 | # $id in scalar This object's unique ID | ||||||||||||||||||||||||||||
| 111 | # $args in hashref The set of arguments currently | ||||||||||||||||||||||||||||
| 112 | # being considered for the | ||||||||||||||||||||||||||||
| 113 | # constructor. | ||||||||||||||||||||||||||||
| 114 | # | ||||||||||||||||||||||||||||
| 115 | # Returns: Success: void | ||||||||||||||||||||||||||||
| 116 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 117 | # | ||||||||||||||||||||||||||||
| 118 | ############################################################################### | ||||||||||||||||||||||||||||
| 119 | sub BUILD | ||||||||||||||||||||||||||||
| 120 | 746 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=6 SCAR=19.1
Pod
documented
| |||||||||||||||||||||||||||||
| 121 | 746 | my ($self, $id, $args) = @_; | |||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 746 | $self->set_type('Books'); | |||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | 746 | ▶ | if ($CAN_PARSE_DATES) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 126 | { | ||||||||||||||||||||||||||||
| 127 | $args->{change_time_sec} = str2time($args->{change_time}) | ||||||||||||||||||||||||||||
| 128 | 746 | ▶ | if ($args->{change_time} and ! $args->{change_time_sec}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"change_time"} and not $args->{"change_time_sec"}
MC/DC0%0/2
$args->{"change_time"} and not $args->{"change_time_sec"}
$args->{"change_time"}
not $args->{"change_time_sec"}
Truth table66%2/3
A and not(B)
A= $args->{"change_time"}B= not $args->{"change_time_sec"}
| |||||||||||||||||||||||||||||
| 129 | $args->{price_time_sec} = str2time($args->{price_time}) | ||||||||||||||||||||||||||||
| 130 | 746 | ▶ | if ($args->{price_time} and ! $args->{price_time_sec}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$args->{"price_time"} and not $args->{"price_time_sec"}
MC/DC0%0/2
$args->{"price_time"} and not $args->{"price_time_sec"}
$args->{"price_time"}
not $args->{"price_time_sec"}
Truth table66%2/3
A and not(B)
A= $args->{"price_time"}B= not $args->{"price_time_sec"}
| |||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 746 | return; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | ############################################################################### | ||||||||||||||||||||||||||||
| 137 | # | ||||||||||||||||||||||||||||
| 138 | # Sub Name: find | ||||||||||||||||||||||||||||
| 139 | # | ||||||||||||||||||||||||||||
| 140 | # Description: Find a single record using the passed-in search criteria. | ||||||||||||||||||||||||||||
| 141 | # Most of the work is done by the super-class: this method | ||||||||||||||||||||||||||||
| 142 | # turns a single-argument call into a proper hashref, and/or | ||||||||||||||||||||||||||||
| 143 | # turns user-supplied arguments into those recognized by the | ||||||||||||||||||||||||||||
| 144 | # API. | ||||||||||||||||||||||||||||
| 145 | # | ||||||||||||||||||||||||||||
| 146 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 147 | # $self in ref Object | ||||||||||||||||||||||||||||
| 148 | # $args in variable See text | ||||||||||||||||||||||||||||
| 149 | # | ||||||||||||||||||||||||||||
| 150 | # Returns: Success: result from SUPER::find | ||||||||||||||||||||||||||||
| 151 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 152 | # | ||||||||||||||||||||||||||||
| 153 | ############################################################################### | ||||||||||||||||||||||||||||
| 154 | sub find | ||||||||||||||||||||||||||||
| 155 | 3 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
find: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||
| 156 | 3 | my ($self, $args) = @_; | |||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | # First, see if we were passed a single scalar for an argument. If so, it | ||||||||||||||||||||||||||||
| 159 | # needs to become either an ISBN or title argument. | ||||||||||||||||||||||||||||
| 160 | 3 | ▶ | if (! ref($args)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 161 | { | ||||||||||||||||||||||||||||
| 162 | 3 | my $obj; | |||||||||||||||||||||||||||
| 163 | 3 | ▶ | if (ref($obj = Business::ISBN->new($args)) and | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref($obj = "Business::ISBN"->new($args)) and $obj->is_valid_checksum eq 1
MC/DC50%1/2
ref($obj = "Business::ISBN"->new($args)) and $obj->is_valid_checksum eq 1
ref($obj = "Business::ISBN"->new($args))
$obj->is_valid_checksum eq 1
Truth table66%2/3
A and B
A= ref($obj = "Business::ISBN"->new($args))B= $obj->is_valid_checksum eq 1
| |||||||||||||||||||||||||||||
| 164 | $obj->is_valid_checksum() eq Business::ISBN::GOOD_ISBN) | ||||||||||||||||||||||||||||
| 165 | { | ||||||||||||||||||||||||||||
| 166 | 2 | $args = { isbn => $args }; | |||||||||||||||||||||||||||
| 167 | } | ||||||||||||||||||||||||||||
| 168 | else | ||||||||||||||||||||||||||||
| 169 | { | ||||||||||||||||||||||||||||
| 170 | 1 | $args = { book_id => $args }; | |||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||
| 174 | 3 | $self->SUPER::find($args); | |||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | ############################################################################### | ||||||||||||||||||||||||||||
| 178 | # | ||||||||||||||||||||||||||||
| 179 | # Sub Name: normalize_args | ||||||||||||||||||||||||||||
| 180 | # | ||||||||||||||||||||||||||||
| 181 | # Description: Normalize the contents of the $args hash reference, turning | ||||||||||||||||||||||||||||
| 182 | # the user-visible (and user-friendlier) arguments into the | ||||||||||||||||||||||||||||
| 183 | # arguments that the API expects. | ||||||||||||||||||||||||||||
| 184 | # | ||||||||||||||||||||||||||||
| 185 | # Also adds some "results" values, to tailor the returned | ||||||||||||||||||||||||||||
| 186 | # content. | ||||||||||||||||||||||||||||
| 187 | # | ||||||||||||||||||||||||||||
| 188 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 189 | # $class in scalar Object ref or class name | ||||||||||||||||||||||||||||
| 190 | # $args in hashref Reference to the arguments hash | ||||||||||||||||||||||||||||
| 191 | # | ||||||||||||||||||||||||||||
| 192 | # Returns: Success: $args (changed) | ||||||||||||||||||||||||||||
| 193 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 194 | # | ||||||||||||||||||||||||||||
| 195 | ############################################################################### | ||||||||||||||||||||||||||||
| 196 | sub normalize_args | ||||||||||||||||||||||||||||
| 197 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
normalize_args: called CC=13 SCAR=35.6
Pod
documented
| |||||||||||||||||||||||||||||
| 198 | 4 | my ($class, $args) = @_; | |||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||
| 200 | 4 | my ($key, $value, @keys, $count, $results, %seen); | |||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||
| 202 | # Turn the collection of arguments into a set that the isbndb.com API can | ||||||||||||||||||||||||||||
| 203 | # use. Each key/value pair has to become a pair of the form "indexX" and | ||||||||||||||||||||||||||||
| 204 | # "valueX". Some keys, like author and publisher, have to be handled with | ||||||||||||||||||||||||||||
| 205 | # more attention. | ||||||||||||||||||||||||||||
| 206 | 4 | @keys = keys %$args; | |||||||||||||||||||||||||||
| 207 | 4 | $count = 0; # Used to gradually increment the "indexX" and "valueX" keys | |||||||||||||||||||||||||||
| 208 | 4 | foreach $key (@keys) | |||||||||||||||||||||||||||
| 209 | { | ||||||||||||||||||||||||||||
| 210 | # If we see "api_key", it means that WebService::ISBNDB::API::search | ||||||||||||||||||||||||||||
| 211 | # curried it into the arglist due to the type-level search being | ||||||||||||||||||||||||||||
| 212 | # called as a static method. | ||||||||||||||||||||||||||||
| 213 | 5 | ▶ | next if $key eq 'api_key'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 4 | $value = $args->{$key}; | |||||||||||||||||||||||||||
| 215 | 4 | delete $args->{$key}; | |||||||||||||||||||||||||||
| 216 | 4 | $count++; | |||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||
| 218 | # If the key is 'author', it may be a name or an Authors object. If it | ||||||||||||||||||||||||||||
| 219 | # is not an object, it has to become a "full" key, which is very non- | ||||||||||||||||||||||||||||
| 220 | # specific. | ||||||||||||||||||||||||||||
| 221 | 4 | ▶ | if ($key eq 'author') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 222 | { | ||||||||||||||||||||||||||||
| 223 | 1 | ▶ | if (ref $value) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 224 | { | ||||||||||||||||||||||||||||
| 225 | 1 | ▶ | if ($value->isa('WebService::ISBNDB::API::Authors')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 226 | { | ||||||||||||||||||||||||||||
| 227 | 1 | $args->{"index$count"} = 'person_id'; | |||||||||||||||||||||||||||
| 228 | 1 | $args->{"value$count"} = $value->get_id; | |||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||
| 230 | else | ||||||||||||||||||||||||||||
| 231 | { | ||||||||||||||||||||||||||||
| 232 | 0 | throw Error::Simple("Value for argument '$key' must be " . | |||||||||||||||||||||||||||
| 233 | 'string or ' . | ||||||||||||||||||||||||||||
| 234 | 'WebService::ISBNDB::API::Authors' . | ||||||||||||||||||||||||||||
| 235 | ' derivative'); | ||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | else | ||||||||||||||||||||||||||||
| 239 | { | ||||||||||||||||||||||||||||
| 240 | 0 | $args->{"index$count"} = 'combined'; | |||||||||||||||||||||||||||
| 241 | 0 | $args->{"value$count"} = $value; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||
| 244 | 1 | next; | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||
| 247 | # If the key is 'publisher', treat the same as with author | ||||||||||||||||||||||||||||
| 248 | 3 | ▶ | if ($key eq 'publisher') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 249 | { | ||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if (ref $value) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 251 | { | ||||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($value->isa('WebService::ISBNDB::API::Publishers')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | { | ||||||||||||||||||||||||||||
| 254 | 0 | $args->{"index$count"} = 'publisher_id'; | |||||||||||||||||||||||||||
| 255 | 0 | $args->{"value$count"} = $value->get_id; | |||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||
| 257 | else | ||||||||||||||||||||||||||||
| 258 | { | ||||||||||||||||||||||||||||
| 259 | 0 | throw Error::Simple("Value for argument '$key' must be " . | |||||||||||||||||||||||||||
| 260 | 'string or ' . | ||||||||||||||||||||||||||||
| 261 | 'WebService::ISBNDB::API::Publishers' . | ||||||||||||||||||||||||||||
| 262 | ' derivative'); | ||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||
| 264 | } | ||||||||||||||||||||||||||||
| 265 | else | ||||||||||||||||||||||||||||
| 266 | { | ||||||||||||||||||||||||||||
| 267 | 0 | $args->{"index$count"} = 'combined'; | |||||||||||||||||||||||||||
| 268 | 0 | $args->{"value$count"} = $value; | |||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | 0 | next; | |||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||
| 274 | # A subject can be an object or an ID. | ||||||||||||||||||||||||||||
| 275 | 3 | ▶ | if ($key eq 'subject') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 276 | { | ||||||||||||||||||||||||||||
| 277 | 0 | ▶ | if (ref $value) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 278 | { | ||||||||||||||||||||||||||||
| 279 | 0 | ▶ | if ($value->isa('WebService::ISBNDB::API::Subjects')) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 280 | { | ||||||||||||||||||||||||||||
| 281 | 0 | $args->{"index$count"} = 'subject_id'; | |||||||||||||||||||||||||||
| 282 | 0 | $args->{"value$count"} = $value->get_id; | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | else | ||||||||||||||||||||||||||||
| 285 | { | ||||||||||||||||||||||||||||
| 286 | 0 | throw Error::Simple("Value for argument '$key' must be " . | |||||||||||||||||||||||||||
| 287 | 'string or ' . | ||||||||||||||||||||||||||||
| 288 | 'WebService::ISBNDB::API::Subjects ' . | ||||||||||||||||||||||||||||
| 289 | 'derivative'); | ||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||
| 292 | else | ||||||||||||||||||||||||||||
| 293 | { | ||||||||||||||||||||||||||||
| 294 | 0 | $args->{"index$count"} = 'subject_id'; | |||||||||||||||||||||||||||
| 295 | 0 | $args->{"value$count"} = $value; | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 0 | next; | |||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||
| 301 | # These are the only other allowed search-keys | ||||||||||||||||||||||||||||
| 302 | 3 | ▶ | if ($key =~ | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 303 | /^(:?dewey_decimal|lcc_number|full|combined|title|isbn|book_id)$/) | ||||||||||||||||||||||||||||
| 304 | { | ||||||||||||||||||||||||||||
| 305 | 3 | $args->{"index$count"} = $key; | |||||||||||||||||||||||||||
| 306 | 3 | $args->{"value$count"} = $value; | |||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||
| 308 | 3 | next; | |||||||||||||||||||||||||||
| 309 | } | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | 0 | throw Error::Simple("'$key' is not a valid search-key for books"); | |||||||||||||||||||||||||||
| 312 | } | ||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||
| 314 | # Add the "results" values that we want | ||||||||||||||||||||||||||||
| 315 | 4 | $args->{results} = [ qw(details prices marc texts subjects authors) ]; | |||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 4 | $args; | |||||||||||||||||||||||||||
| 318 | } | ||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||
| 320 | ############################################################################### | ||||||||||||||||||||||||||||
| 321 | # | ||||||||||||||||||||||||||||
| 322 | # Sub Name: set_id | ||||||||||||||||||||||||||||
| 323 | # | ||||||||||||||||||||||||||||
| 324 | # Description: Set the ID attribute on the object. Done manually so that | ||||||||||||||||||||||||||||
| 325 | # we can restrict it to this package. | ||||||||||||||||||||||||||||
| 326 | # | ||||||||||||||||||||||||||||
| 327 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 328 | # $self in ref Object | ||||||||||||||||||||||||||||
| 329 | # $id in scalar ID, taken from isbndb.com data | ||||||||||||||||||||||||||||
| 330 | # | ||||||||||||||||||||||||||||
| 331 | # Globals: %id | ||||||||||||||||||||||||||||
| 332 | # | ||||||||||||||||||||||||||||
| 333 | # Returns: $self | ||||||||||||||||||||||||||||
| 334 | # | ||||||||||||||||||||||||||||
| 335 | ############################################################################### | ||||||||||||||||||||||||||||
| 336 | 0 | ▶ | sub set_id : RESTRICTED | ||||||||||||||||||||||||||
|
Subroutine
set_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||
| 338 | 0 | my ($self, $id) = @_; | |||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||
| 340 | 0 | $id{ident $self} = $id; | |||||||||||||||||||||||||||
| 341 | 0 | $self; | |||||||||||||||||||||||||||
| 342 | 4 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||
| 344 | ############################################################################### | ||||||||||||||||||||||||||||
| 345 | # | ||||||||||||||||||||||||||||
| 346 | # Sub Name: set_isbn | ||||||||||||||||||||||||||||
| 347 | # | ||||||||||||||||||||||||||||
| 348 | # Description: Set the ISBN for this object. Tests the new value before | ||||||||||||||||||||||||||||
| 349 | # assigning it. | ||||||||||||||||||||||||||||
| 350 | # | ||||||||||||||||||||||||||||
| 351 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 352 | # $self in ref Object | ||||||||||||||||||||||||||||
| 353 | # $isbn in scalar New ISBN value | ||||||||||||||||||||||||||||
| 354 | # | ||||||||||||||||||||||||||||
| 355 | # Globals: %isbn | ||||||||||||||||||||||||||||
| 356 | # | ||||||||||||||||||||||||||||
| 357 | # Returns: Success: $self | ||||||||||||||||||||||||||||
| 358 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 359 | # | ||||||||||||||||||||||||||||
| 360 | ############################################################################### | ||||||||||||||||||||||||||||
| 361 | sub set_isbn | ||||||||||||||||||||||||||||
| 362 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_isbn: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 363 | 0 | my ($self, $isbn) = @_; | |||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||
| 365 | 0 | ▶ | throw Error::Simple("The value '$isbn' is not a valid ISBN") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 366 | unless (Business::ISBN->new($isbn)->is_valid_checksum eq | ||||||||||||||||||||||||||||
| 367 | Business::ISBN::GOOD_ISBN); | ||||||||||||||||||||||||||||
| 368 | 0 | $isbn{ident $self} = $isbn; | |||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||
| 370 | 0 | $self; | |||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||
| 373 | ############################################################################### | ||||||||||||||||||||||||||||
| 374 | # | ||||||||||||||||||||||||||||
| 375 | # Sub Name: get_publisher | ||||||||||||||||||||||||||||
| 376 | # | ||||||||||||||||||||||||||||
| 377 | # Description: Retrieve the "publisher" attribute for this object. If the | ||||||||||||||||||||||||||||
| 378 | # value is a string rather than a reference, assume that it | ||||||||||||||||||||||||||||
| 379 | # is an ID, and fetch the actual Publisher object before | ||||||||||||||||||||||||||||
| 380 | # returning the value. | ||||||||||||||||||||||||||||
| 381 | # | ||||||||||||||||||||||||||||
| 382 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 383 | # $self in ref Object | ||||||||||||||||||||||||||||
| 384 | # | ||||||||||||||||||||||||||||
| 385 | # Globals: %publisher | ||||||||||||||||||||||||||||
| 386 | # | ||||||||||||||||||||||||||||
| 387 | # Returns: Success: Publisher object | ||||||||||||||||||||||||||||
| 388 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 389 | # | ||||||||||||||||||||||||||||
| 390 | ############################################################################### | ||||||||||||||||||||||||||||
| 391 | sub get_publisher | ||||||||||||||||||||||||||||
| 392 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_publisher: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 393 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||
| 395 | 0 | my $id = ident $self; | |||||||||||||||||||||||||||
| 396 | |||||||||||||||||||||||||||||
| 397 | 0 | my $publisher = $publisher{$id}; | |||||||||||||||||||||||||||
| 398 | 0 | ▶ | unless (ref $publisher) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 399 | { | ||||||||||||||||||||||||||||
| 400 | 0 | my $class = $self->class_for_type('Publishers'); | |||||||||||||||||||||||||||
| 401 | # Make sure it's loaded | ||||||||||||||||||||||||||||
| 402 | 0 | eval "require $class;"; | |||||||||||||||||||||||||||
| 403 | 0 | $publisher = $class->find({ publisher_id => $publisher }); | |||||||||||||||||||||||||||
| 404 | 0 | $publisher{$id} = $publisher; | |||||||||||||||||||||||||||
| 405 | } | ||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||
| 407 | 0 | $publisher; | |||||||||||||||||||||||||||
| 408 | } | ||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||
| 410 | ############################################################################### | ||||||||||||||||||||||||||||
| 411 | # | ||||||||||||||||||||||||||||
| 412 | # Sub Name: set_authors | ||||||||||||||||||||||||||||
| 413 | # | ||||||||||||||||||||||||||||
| 414 | # Description: Set the list of Authors objects for this instance. The list | ||||||||||||||||||||||||||||
| 415 | # will initially be a list of IDs, taken from the attributes | ||||||||||||||||||||||||||||
| 416 | # of the XML. Only upon read-access (via get_authors) will | ||||||||||||||||||||||||||||
| 417 | # the list be turned into real objects. | ||||||||||||||||||||||||||||
| 418 | # | ||||||||||||||||||||||||||||
| 419 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 420 | # $self in ref Object | ||||||||||||||||||||||||||||
| 421 | # $list in ref List-reference of author data | ||||||||||||||||||||||||||||
| 422 | # | ||||||||||||||||||||||||||||
| 423 | # Globals: %authors | ||||||||||||||||||||||||||||
| 424 | # | ||||||||||||||||||||||||||||
| 425 | # Returns: Success: $self | ||||||||||||||||||||||||||||
| 426 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 427 | # | ||||||||||||||||||||||||||||
| 428 | ############################################################################### | ||||||||||||||||||||||||||||
| 429 | sub set_authors | ||||||||||||||||||||||||||||
| 430 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_authors: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 431 | 0 | my ($self, $list) = @_; | |||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||
| 433 | 0 | ▶ | throw Error::Simple("Argument to 'set_authors' must be a list reference") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 434 | unless (ref($list) eq 'ARRAY'); | ||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||
| 436 | # Make a copy of the list | ||||||||||||||||||||||||||||
| 437 | 0 | $authors{ident $self} = [ @$list ]; | |||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | 0 | $self; | |||||||||||||||||||||||||||
| 440 | } | ||||||||||||||||||||||||||||
| 441 | |||||||||||||||||||||||||||||
| 442 | ############################################################################### | ||||||||||||||||||||||||||||
| 443 | # | ||||||||||||||||||||||||||||
| 444 | # Sub Name: get_authors | ||||||||||||||||||||||||||||
| 445 | # | ||||||||||||||||||||||||||||
| 446 | # Description: Return a list-reference of the authors of the book. If this | ||||||||||||||||||||||||||||
| 447 | # is the first such request, then the author values are going | ||||||||||||||||||||||||||||
| 448 | # to be scalars, not objects, and must be converted to | ||||||||||||||||||||||||||||
| 449 | # objects before being returned. | ||||||||||||||||||||||||||||
| 450 | # | ||||||||||||||||||||||||||||
| 451 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 452 | # $self in ref Object | ||||||||||||||||||||||||||||
| 453 | # | ||||||||||||||||||||||||||||
| 454 | # Globals: %authors | ||||||||||||||||||||||||||||
| 455 | # | ||||||||||||||||||||||||||||
| 456 | # Returns: Success: list-reference of data | ||||||||||||||||||||||||||||
| 457 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 458 | # | ||||||||||||||||||||||||||||
| 459 | ############################################################################### | ||||||||||||||||||||||||||||
| 460 | sub get_authors | ||||||||||||||||||||||||||||
| 461 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_authors: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 462 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||
| 464 | 1 | my $authors = $authors{ident $self}; | |||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | # If the first element is not a reference, we need to transform the list | ||||||||||||||||||||||||||||
| 467 | 1 | ▶ | if (grep(! ref($_), @$authors)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 468 | { | ||||||||||||||||||||||||||||
| 469 | 1 | my $class = $self->class_for_type('Authors'); | |||||||||||||||||||||||||||
| 470 | # Make sure it's loaded | ||||||||||||||||||||||||||||
| 471 | 1 | eval "require $class;"; | |||||||||||||||||||||||||||
| 472 | 1 | my $auth_id; | |||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||
| 474 | 1 | for (0 .. $#$authors) | |||||||||||||||||||||||||||
| 475 | { | ||||||||||||||||||||||||||||
| 476 | 2 | ▶ | unless (ref($auth_id = $authors->[$_])) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 477 | { | ||||||||||||||||||||||||||||
| 478 | 2 | ▶ | throw Error::Simple("No author found for ID '$auth_id'") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 479 | unless ref($authors->[$_] = $class->find({ id => | ||||||||||||||||||||||||||||
| 480 | $auth_id })); | ||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||
| 482 | } | ||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | # Make a copy, so the real reference doesn't get altered | ||||||||||||||||||||||||||||
| 486 | 1 | [ @$authors ]; | |||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||
| 489 | ############################################################################### | ||||||||||||||||||||||||||||
| 490 | # | ||||||||||||||||||||||||||||
| 491 | # Sub Name: set_subjects | ||||||||||||||||||||||||||||
| 492 | # | ||||||||||||||||||||||||||||
| 493 | # Description: Set the list of Subjects objects for this instance. The | ||||||||||||||||||||||||||||
| 494 | # list will initially be a list of IDs, taken from the | ||||||||||||||||||||||||||||
| 495 | # attributes of the XML. Only upon read-access (via | ||||||||||||||||||||||||||||
| 496 | # get_subjects) will the list be turned into real objects. | ||||||||||||||||||||||||||||
| 497 | # | ||||||||||||||||||||||||||||
| 498 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 499 | # $self in ref Object | ||||||||||||||||||||||||||||
| 500 | # $list in ref List-reference of category data | ||||||||||||||||||||||||||||
| 501 | # | ||||||||||||||||||||||||||||
| 502 | # Globals: %subjects | ||||||||||||||||||||||||||||
| 503 | # | ||||||||||||||||||||||||||||
| 504 | # Returns: Success: $self | ||||||||||||||||||||||||||||
| 505 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 506 | # | ||||||||||||||||||||||||||||
| 507 | ############################################################################### | ||||||||||||||||||||||||||||
| 508 | sub set_subjects | ||||||||||||||||||||||||||||
| 509 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_subjects: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 510 | 0 | my ($self, $list) = @_; | |||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||
| 512 | 0 | ▶ | throw Error::Simple("Argument to 'set_subjects' must be a list reference") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 513 | unless (ref($list) eq 'ARRAY'); | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | # Make a copy of the list | ||||||||||||||||||||||||||||
| 516 | 0 | $subjects{ident $self} = [ @$list ]; | |||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||
| 518 | 0 | $self; | |||||||||||||||||||||||||||
| 519 | } | ||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||
| 521 | ############################################################################### | ||||||||||||||||||||||||||||
| 522 | # | ||||||||||||||||||||||||||||
| 523 | # Sub Name: get_subjects | ||||||||||||||||||||||||||||
| 524 | # | ||||||||||||||||||||||||||||
| 525 | # Description: Return a list-reference of the book subjects. If this is | ||||||||||||||||||||||||||||
| 526 | # the first such request, then the subject values are going | ||||||||||||||||||||||||||||
| 527 | # to be scalars, not objects, and must be converted to | ||||||||||||||||||||||||||||
| 528 | # objects before being returned. | ||||||||||||||||||||||||||||
| 529 | # | ||||||||||||||||||||||||||||
| 530 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 531 | # $self in ref Object | ||||||||||||||||||||||||||||
| 532 | # | ||||||||||||||||||||||||||||
| 533 | # Globals: %subjects | ||||||||||||||||||||||||||||
| 534 | # | ||||||||||||||||||||||||||||
| 535 | # Returns: Success: list-reference of data | ||||||||||||||||||||||||||||
| 536 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 537 | # | ||||||||||||||||||||||||||||
| 538 | ############################################################################### | ||||||||||||||||||||||||||||
| 539 | sub get_subjects | ||||||||||||||||||||||||||||
| 540 | 1 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
get_subjects: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 541 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | 1 | my $subjects = $subjects{ident $self}; | |||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||
| 545 | # If any element is not a reference, we need to transform the list | ||||||||||||||||||||||||||||
| 546 | 1 | ▶ | if (grep(! ref($_), @$subjects)) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 547 | { | ||||||||||||||||||||||||||||
| 548 | 1 | my $class = $self->class_for_type('Subjects'); | |||||||||||||||||||||||||||
| 549 | # Make sure it's loaded | ||||||||||||||||||||||||||||
| 550 | 1 | eval "require $class;"; | |||||||||||||||||||||||||||
| 551 | 1 | my $subj_id; | |||||||||||||||||||||||||||
| 552 | |||||||||||||||||||||||||||||
| 553 | 1 | for (0 .. $#$subjects) | |||||||||||||||||||||||||||
| 554 | { | ||||||||||||||||||||||||||||
| 555 | 2 | ▶ | unless (ref($subj_id = $subjects->[$_])) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 556 | { | ||||||||||||||||||||||||||||
| 557 | 2 | ▶ | throw Error::Simple("No subject found for ID '$subj_id'") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 558 | unless ref($subjects->[$_] = $class->find({ id => | ||||||||||||||||||||||||||||
| 559 | $subj_id })); | ||||||||||||||||||||||||||||
| 560 | } | ||||||||||||||||||||||||||||
| 561 | } | ||||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||
| 564 | # Make a copy, so the real reference doesn't get altered | ||||||||||||||||||||||||||||
| 565 | 1 | [ @$subjects ]; | |||||||||||||||||||||||||||
| 566 | } | ||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | ############################################################################### | ||||||||||||||||||||||||||||
| 569 | # | ||||||||||||||||||||||||||||
| 570 | # Sub Name: set_change_time | ||||||||||||||||||||||||||||
| 571 | # | ||||||||||||||||||||||||||||
| 572 | # Description: Set the change_time value; also update change_time_sec if | ||||||||||||||||||||||||||||
| 573 | # $CAN_PARSE_DATES is true. | ||||||||||||||||||||||||||||
| 574 | # | ||||||||||||||||||||||||||||
| 575 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 576 | # $self in ref Object | ||||||||||||||||||||||||||||
| 577 | # $time in scalar Time-string | ||||||||||||||||||||||||||||
| 578 | # | ||||||||||||||||||||||||||||
| 579 | # Globals: $CAN_PARSE_DATES | ||||||||||||||||||||||||||||
| 580 | # %change_time | ||||||||||||||||||||||||||||
| 581 | # %change_time_sec | ||||||||||||||||||||||||||||
| 582 | # | ||||||||||||||||||||||||||||
| 583 | # Returns: $self | ||||||||||||||||||||||||||||
| 584 | # | ||||||||||||||||||||||||||||
| 585 | ############################################################################### | ||||||||||||||||||||||||||||
| 586 | sub set_change_time | ||||||||||||||||||||||||||||
| 587 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_change_time: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 588 | 0 | my ($self, $time) = @_; | |||||||||||||||||||||||||||
| 589 | 0 | my $id = ident $self; | |||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||
| 591 | 0 | $change_time{$id} = $time; | |||||||||||||||||||||||||||
| 592 | 0 | ▶ | $change_time_sec{$id} = str2time($time) if $CAN_PARSE_DATES; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||
| 594 | 0 | $self; | |||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||
| 596 | |||||||||||||||||||||||||||||
| 597 | ############################################################################### | ||||||||||||||||||||||||||||
| 598 | # | ||||||||||||||||||||||||||||
| 599 | # Sub Name: set_change_time_sec | ||||||||||||||||||||||||||||
| 600 | # | ||||||||||||||||||||||||||||
| 601 | # Description: Set the change_time_sec value; also updates change_time. | ||||||||||||||||||||||||||||
| 602 | # | ||||||||||||||||||||||||||||
| 603 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 604 | # $self in ref Object | ||||||||||||||||||||||||||||
| 605 | # $time in scalar Time, in seconds | ||||||||||||||||||||||||||||
| 606 | # | ||||||||||||||||||||||||||||
| 607 | # Globals: %change_time | ||||||||||||||||||||||||||||
| 608 | # %change_time_sec | ||||||||||||||||||||||||||||
| 609 | # | ||||||||||||||||||||||||||||
| 610 | # Returns: $self | ||||||||||||||||||||||||||||
| 611 | # | ||||||||||||||||||||||||||||
| 612 | ############################################################################### | ||||||||||||||||||||||||||||
| 613 | sub set_change_time_sec | ||||||||||||||||||||||||||||
| 614 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_change_time_sec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 615 | 0 | my ($self, $time) = @_; | |||||||||||||||||||||||||||
| 616 | 0 | my $id = ident $self; | |||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||
| 618 | 0 | $change_time_sec{$id} = $time; | |||||||||||||||||||||||||||
| 619 | 0 | my @parts = localtime $time; | |||||||||||||||||||||||||||
| 620 | 0 | $change_time{$id} = sprintf("%4d-%02d-%02dT%02d:%02d:%02dZ", | |||||||||||||||||||||||||||
| 621 | $parts[5] + 1900, # year | ||||||||||||||||||||||||||||
| 622 | $parts[4] + 1, # month | ||||||||||||||||||||||||||||
| 623 | $parts[3], # day | ||||||||||||||||||||||||||||
| 624 | @parts[2,1,0]); # hours, mins, secs | ||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||
| 626 | 0 | $self; | |||||||||||||||||||||||||||
| 627 | } | ||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||
| 629 | ############################################################################### | ||||||||||||||||||||||||||||
| 630 | # | ||||||||||||||||||||||||||||
| 631 | # Sub Name: set_price_time | ||||||||||||||||||||||||||||
| 632 | # | ||||||||||||||||||||||||||||
| 633 | # Description: Set the price_time value; also update price_time_sec if | ||||||||||||||||||||||||||||
| 634 | # $CAN_PARSE_DATES is true. | ||||||||||||||||||||||||||||
| 635 | # | ||||||||||||||||||||||||||||
| 636 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 637 | # $self in ref Object | ||||||||||||||||||||||||||||
| 638 | # $time in scalar Time-string | ||||||||||||||||||||||||||||
| 639 | # | ||||||||||||||||||||||||||||
| 640 | # Globals: $CAN_PARSE_DATES | ||||||||||||||||||||||||||||
| 641 | # %price_time | ||||||||||||||||||||||||||||
| 642 | # %price_time_sec | ||||||||||||||||||||||||||||
| 643 | # | ||||||||||||||||||||||||||||
| 644 | # Returns: $self | ||||||||||||||||||||||||||||
| 645 | # | ||||||||||||||||||||||||||||
| 646 | ############################################################################### | ||||||||||||||||||||||||||||
| 647 | sub set_price_time | ||||||||||||||||||||||||||||
| 648 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_price_time: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 649 | 0 | my ($self, $time) = @_; | |||||||||||||||||||||||||||
| 650 | 0 | my $id = ident $self; | |||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||
| 652 | 0 | $price_time{$id} = $time; | |||||||||||||||||||||||||||
| 653 | 0 | ▶ | $price_time_sec{$id} = str2time($time) if $CAN_PARSE_DATES; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||
| 655 | 0 | $self; | |||||||||||||||||||||||||||
| 656 | } | ||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||
| 658 | ############################################################################### | ||||||||||||||||||||||||||||
| 659 | # | ||||||||||||||||||||||||||||
| 660 | # Sub Name: set_price_time_sec | ||||||||||||||||||||||||||||
| 661 | # | ||||||||||||||||||||||||||||
| 662 | # Description: Set the price_time_sec value; also updates price_time. | ||||||||||||||||||||||||||||
| 663 | # | ||||||||||||||||||||||||||||
| 664 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 665 | # $self in ref Object | ||||||||||||||||||||||||||||
| 666 | # $time in scalar Time, in seconds | ||||||||||||||||||||||||||||
| 667 | # | ||||||||||||||||||||||||||||
| 668 | # Globals: %price_time | ||||||||||||||||||||||||||||
| 669 | # %price_time_sec | ||||||||||||||||||||||||||||
| 670 | # | ||||||||||||||||||||||||||||
| 671 | # Returns: $self | ||||||||||||||||||||||||||||
| 672 | # | ||||||||||||||||||||||||||||
| 673 | ############################################################################### | ||||||||||||||||||||||||||||
| 674 | sub set_price_time_sec | ||||||||||||||||||||||||||||
| 675 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_price_time_sec: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 676 | 0 | my ($self, $time) = @_; | |||||||||||||||||||||||||||
| 677 | 0 | my $id = ident $self; | |||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||
| 679 | 0 | $price_time_sec{$id} = $time; | |||||||||||||||||||||||||||
| 680 | 0 | my @parts = localtime $time; | |||||||||||||||||||||||||||
| 681 | 0 | $price_time{$id} = sprintf("%4d-%02d-%02dT%02d:%02d:%02dZ", | |||||||||||||||||||||||||||
| 682 | $parts[5] + 1900, # year | ||||||||||||||||||||||||||||
| 683 | $parts[4] + 1, # month | ||||||||||||||||||||||||||||
| 684 | $parts[3], # day | ||||||||||||||||||||||||||||
| 685 | @parts[2,1,0]); # hours, mins, secs | ||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||
| 687 | 0 | $self; | |||||||||||||||||||||||||||
| 688 | } | ||||||||||||||||||||||||||||
| 689 | |||||||||||||||||||||||||||||
| 690 | ############################################################################### | ||||||||||||||||||||||||||||
| 691 | # | ||||||||||||||||||||||||||||
| 692 | # Sub Name: set_prices | ||||||||||||||||||||||||||||
| 693 | # | ||||||||||||||||||||||||||||
| 694 | # Description: Set new data for the price information. Checks that the | ||||||||||||||||||||||||||||
| 695 | # passed-in value is a list-ref, and that all elements are | ||||||||||||||||||||||||||||
| 696 | # hash refs. | ||||||||||||||||||||||||||||
| 697 | # | ||||||||||||||||||||||||||||
| 698 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 699 | # $self in ref Object | ||||||||||||||||||||||||||||
| 700 | # $prices in listref New price data | ||||||||||||||||||||||||||||
| 701 | # | ||||||||||||||||||||||||||||
| 702 | # Globals: %prices | ||||||||||||||||||||||||||||
| 703 | # | ||||||||||||||||||||||||||||
| 704 | # Returns: Success: $self | ||||||||||||||||||||||||||||
| 705 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 706 | # | ||||||||||||||||||||||||||||
| 707 | ############################################################################### | ||||||||||||||||||||||||||||
| 708 | sub set_prices | ||||||||||||||||||||||||||||
| 709 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_prices: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 710 | 0 | my ($self, $prices) = @_; | |||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||
| 712 | 0 | ▶ | throw Error::Simple('Argument to "set_prices" must be an array reference') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 713 | unless (ref($prices) eq 'ARRAY'); | ||||||||||||||||||||||||||||
| 714 | 0 | ▶ | throw Error::Simple('All elements of the array ref to "set_prices" must ' . | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 715 | 'be hash references') | ||||||||||||||||||||||||||||
| 716 | if (grep(ref($_) ne 'HASH', @$prices)); | ||||||||||||||||||||||||||||
| 717 | 0 | $prices{ident $self} = _copy_aoh($prices); | |||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||
| 719 | 0 | $self; | |||||||||||||||||||||||||||
| 720 | } | ||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||
| 722 | ############################################################################### | ||||||||||||||||||||||||||||
| 723 | # | ||||||||||||||||||||||||||||
| 724 | # Sub Name: set_marc | ||||||||||||||||||||||||||||
| 725 | # | ||||||||||||||||||||||||||||
| 726 | # Description: Set new data for the MARC information. Checks that the | ||||||||||||||||||||||||||||
| 727 | # passed-in value is a list-ref, and that all elements are | ||||||||||||||||||||||||||||
| 728 | # hash refs. | ||||||||||||||||||||||||||||
| 729 | # | ||||||||||||||||||||||||||||
| 730 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 731 | # $self in ref Object | ||||||||||||||||||||||||||||
| 732 | # $marc in listref New MARC data | ||||||||||||||||||||||||||||
| 733 | # | ||||||||||||||||||||||||||||
| 734 | # Globals: %marc | ||||||||||||||||||||||||||||
| 735 | # | ||||||||||||||||||||||||||||
| 736 | # Returns: Success: $self | ||||||||||||||||||||||||||||
| 737 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 738 | # | ||||||||||||||||||||||||||||
| 739 | ############################################################################### | ||||||||||||||||||||||||||||
| 740 | sub set_marc | ||||||||||||||||||||||||||||
| 741 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
set_marc: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 742 | 0 | my ($self, $marc) = @_; | |||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||
| 744 | 0 | ▶ | throw Error::Simple('Argument to "set_marc" must be an array reference') | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 745 | unless (ref($marc) eq 'ARRAY'); | ||||||||||||||||||||||||||||
| 746 | 0 | ▶ | throw Error::Simple('All elements of the array ref to "set_marc" must ' . | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 747 | 'be hash references') | ||||||||||||||||||||||||||||
| 748 | if (grep(ref($_) ne 'HASH', @$marc)); | ||||||||||||||||||||||||||||
| 749 | 0 | $marc{ident $self} = _copy_aoh($marc); | |||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||
| 751 | 0 | $self; | |||||||||||||||||||||||||||
| 752 | } | ||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||
| 754 | ############################################################################### | ||||||||||||||||||||||||||||
| 755 | # | ||||||||||||||||||||||||||||
| 756 | # Sub Name: copy | ||||||||||||||||||||||||||||
| 757 | # | ||||||||||||||||||||||||||||
| 758 | # Description: Copy the Books-specific attributes over from target object | ||||||||||||||||||||||||||||
| 759 | # to caller. | ||||||||||||||||||||||||||||
| 760 | # | ||||||||||||||||||||||||||||
| 761 | # Arguments: NAME IN/OUT TYPE DESCRIPTION | ||||||||||||||||||||||||||||
| 762 | # $self in ref Object | ||||||||||||||||||||||||||||
| 763 | # $target in ref Object of the same class | ||||||||||||||||||||||||||||
| 764 | # | ||||||||||||||||||||||||||||
| 765 | # Globals: %id | ||||||||||||||||||||||||||||
| 766 | # %isbn | ||||||||||||||||||||||||||||
| 767 | # %title | ||||||||||||||||||||||||||||
| 768 | # %longtitle | ||||||||||||||||||||||||||||
| 769 | # %authors | ||||||||||||||||||||||||||||
| 770 | # %authors_text | ||||||||||||||||||||||||||||
| 771 | # %publisher | ||||||||||||||||||||||||||||
| 772 | # %publisher_text | ||||||||||||||||||||||||||||
| 773 | # %subjects | ||||||||||||||||||||||||||||
| 774 | # %dewey_decimal | ||||||||||||||||||||||||||||
| 775 | # %dewey_decimal_normalized | ||||||||||||||||||||||||||||
| 776 | # %lcc_number | ||||||||||||||||||||||||||||
| 777 | # %language | ||||||||||||||||||||||||||||
| 778 | # %physical_description_text | ||||||||||||||||||||||||||||
| 779 | # %edition_info | ||||||||||||||||||||||||||||
| 780 | # %change_time | ||||||||||||||||||||||||||||
| 781 | # %change_time_sec | ||||||||||||||||||||||||||||
| 782 | # %price_time | ||||||||||||||||||||||||||||
| 783 | # %price_time_sec | ||||||||||||||||||||||||||||
| 784 | # %summary | ||||||||||||||||||||||||||||
| 785 | # %notes | ||||||||||||||||||||||||||||
| 786 | # %urlstext | ||||||||||||||||||||||||||||
| 787 | # %awardstext | ||||||||||||||||||||||||||||
| 788 | # %prices | ||||||||||||||||||||||||||||
| 789 | # %marc | ||||||||||||||||||||||||||||
| 790 | # | ||||||||||||||||||||||||||||
| 791 | # Returns: Success: void | ||||||||||||||||||||||||||||
| 792 | # Failure: throws Error::Simple | ||||||||||||||||||||||||||||
| 793 | # | ||||||||||||||||||||||||||||
| 794 | ############################################################################### | ||||||||||||||||||||||||||||
| 795 | 0 | ▶ | sub copy : CUMULATIVE | ||||||||||||||||||||||||||
|
Subroutine
copy: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||
| 796 | { | ||||||||||||||||||||||||||||
| 797 | 0 | my ($self, $target) = @_; | |||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||
| 799 | 0 | ▶ | throw Error::Simple("Argument to 'copy' must be the same class as caller") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 800 | unless (ref($self) eq ref($target)); | ||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||
| 802 | 0 | my $id1 = ident $self; | |||||||||||||||||||||||||||
| 803 | 0 | my $id2 = ident $target; | |||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||
| 805 | # Do the simple (scalar) attributes first | ||||||||||||||||||||||||||||
| 806 | 0 | $id{$id1} = $id{$id2}; | |||||||||||||||||||||||||||
| 807 | 0 | $isbn{$id1} = $isbn{$id2}; | |||||||||||||||||||||||||||
| 808 | 0 | $title{$id1} = $title{$id2}; | |||||||||||||||||||||||||||
| 809 | 0 | $longtitle{$id1} = $longtitle{$id2}; | |||||||||||||||||||||||||||
| 810 | 0 | $authors_text{$id1} = $authors_text{$id2}; | |||||||||||||||||||||||||||
| 811 | 0 | $publisher_text{$id1} = $publisher_text{$id2}; | |||||||||||||||||||||||||||
| 812 | 0 | $publisher{$id1} = $publisher{$id2}; | |||||||||||||||||||||||||||
| 813 | 0 | $dewey_decimal{$id1} = $dewey_decimal{$id2}; | |||||||||||||||||||||||||||
| 814 | 0 | $dewey_decimal_normalized{$id1} = $dewey_decimal_normalized{$id2}; | |||||||||||||||||||||||||||
| 815 | 0 | $lcc_number{$id1} = $lcc_number{$id2}; | |||||||||||||||||||||||||||
| 816 | 0 | $language{$id1} = $language{$id2}; | |||||||||||||||||||||||||||
| 817 | 0 | $physical_description_text{$id1} = $physical_description_text{$id2}; | |||||||||||||||||||||||||||
| 818 | 0 | $edition_info{$id1} = $edition_info{$id2}; | |||||||||||||||||||||||||||
| 819 | 0 | $change_time{$id1} = $change_time{$id2}; | |||||||||||||||||||||||||||
| 820 | 0 | $change_time_sec{$id1} = $change_time_sec{$id2}; | |||||||||||||||||||||||||||
| 821 | 0 | $price_time{$id1} = $price_time{$id2}; | |||||||||||||||||||||||||||
| 822 | 0 | $price_time_sec{$id1} = $price_time_sec{$id2}; | |||||||||||||||||||||||||||
| 823 | 0 | $summary{$id1} = $summary{$id2}; | |||||||||||||||||||||||||||
| 824 | 0 | $notes{$id1} = $notes{$id2}; | |||||||||||||||||||||||||||
| 825 | 0 | $urlstext{$id1} = $urlstext{$id2}; | |||||||||||||||||||||||||||
| 826 | 0 | $awardstext{$id1} = $awardstext{$id2}; | |||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||
| 828 | # Each of these must be tested, and references copied by value | ||||||||||||||||||||||||||||
| 829 | 0 | ▶ | $authors{$id1} = [ @{$authors{$id2}} ] if ref($authors{$id2}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 830 | 0 | ▶ | $subjects{$id1} = [ @{$subjects{$id2}} ] if ref($subjects{$id2}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 831 | 0 | ▶ | $prices{$id1} = _copy_aoh($prices{$id2}) if ref($prices{$id2}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 832 | 0 | ▶ | $marc{$id1} = _copy_aoh($marc{$id2}) if ref($marc{$id2}); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 833 | |||||||||||||||||||||||||||||
| 834 | 0 | return; | |||||||||||||||||||||||||||
| 835 | 4 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||
| 837 | # Copy the array-of-hashrefs and return the new | ||||||||||||||||||||||||||||
| 838 | sub _copy_aoh | ||||||||||||||||||||||||||||
| 839 | 0 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
_copy_aoh: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 840 | 0 | my $list = shift; | |||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||
| 842 | 0 | my $new = []; | |||||||||||||||||||||||||||
| 843 | 0 | for (@$list) | |||||||||||||||||||||||||||
| 844 | { | ||||||||||||||||||||||||||||
| 845 | 0 | push(@$new, { %$_ }); | |||||||||||||||||||||||||||
| 846 | } | ||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||
| 848 | 0 | $new; | |||||||||||||||||||||||||||
| 849 | } | ||||||||||||||||||||||||||||
| 850 | |||||||||||||||||||||||||||||
| 851 | 4 | 1; | |||||||||||||||||||||||||||
| 852 | |||||||||||||||||||||||||||||
| 853 | =pod | ||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||
| 855 | =head1 NAME | ||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||
| 857 | WebService::ISBNDB::API::Books - Data class for book information | ||||||||||||||||||||||||||||
| 858 | |||||||||||||||||||||||||||||
| 859 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||
| 861 | use WebService::ISBNDB::API::Books; | ||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||
| 863 | my $book = WebService::ISBNDB::API->new({ api_key => $key, | ||||||||||||||||||||||||||||
| 864 | isbn => '0596002068' }); | ||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||
| 866 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||
| 868 | This class represents book data from B<isbndb.com>. It is a sub-class of | ||||||||||||||||||||||||||||
| 869 | B<WebService::ISBNDB::API> (see L<WebService::ISBNDB::API>), and inherits all | ||||||||||||||||||||||||||||
| 870 | the attributes and methods from that class. | ||||||||||||||||||||||||||||
| 871 | |||||||||||||||||||||||||||||
| 872 | =head1 METHODS | ||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||
| 874 | The following methods are specific to this class, or overridden from the | ||||||||||||||||||||||||||||
| 875 | super-class. | ||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||
| 877 | =head2 Constructor | ||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||
| 879 | The constructor for this class may take a single scalar argument in lieu of a | ||||||||||||||||||||||||||||
| 880 | hash reference: | ||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||
| 882 | =over 4 | ||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||
| 884 | =item new($ISBN|$TITLE|$ARGS) | ||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||
| 886 | This constructs a new object and returns a referent to it. If the parameter | ||||||||||||||||||||||||||||
| 887 | passed is a hash reference, it is handled as normal, per B<Class::Std> | ||||||||||||||||||||||||||||
| 888 | mechanics. If the value is a scalar, it is tested to see if it is a valid | ||||||||||||||||||||||||||||
| 889 | ISBN (using the B<Business::ISBN> module). If it is, it is used as a search | ||||||||||||||||||||||||||||
| 890 | key to find the corresponding book. If it is not a valid ISBN, it is assumed | ||||||||||||||||||||||||||||
| 891 | to be the title, and is likewise used as a search key. Since the title may | ||||||||||||||||||||||||||||
| 892 | return more than one match, the first matching record from the source is used | ||||||||||||||||||||||||||||
| 893 | to construct the object. | ||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||
| 895 | If the argument is the hash-reference form, then a new object is always | ||||||||||||||||||||||||||||
| 896 | constructed; to perform searches see the search() and find() methods. Thus, | ||||||||||||||||||||||||||||
| 897 | the following two lines are in fact different: | ||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||
| 899 | $book = WebService::ISBNDB::API::Books->new({ isbn => '0596002068' }); | ||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||
| 901 | $book = WebService::ISBNDB::API::Books->new('0596002068'); | ||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||
| 903 | The first creates a new object that has only the C<isbn> attribute set. The | ||||||||||||||||||||||||||||
| 904 | second returns a new object that represents the book with ISBN C<0596002068>, | ||||||||||||||||||||||||||||
| 905 | with all data present. | ||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||
| 907 | =back | ||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||
| 909 | The class also defines: | ||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||
| 911 | =over 4 | ||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||
| 913 | =item copy($TARGET) | ||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||
| 915 | Copies the target object into the calling object. All attributes (including | ||||||||||||||||||||||||||||
| 916 | the ID) are copied. This method is marked "CUMULATIVE" (see L<Class::Std>), | ||||||||||||||||||||||||||||
| 917 | and any sub-class of this class should provide their own copy() and also mark | ||||||||||||||||||||||||||||
| 918 | it "CUMULATIVE", to ensure that all attributes at all levels are copied. | ||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||
| 920 | =back | ||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||
| 922 | See the copy() method in L<WebService::ISBNDB::API>. | ||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||
| 924 | =head2 Accessors | ||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||
| 926 | The following attributes are used to maintain the content of a book object: | ||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||
| 928 | =over 4 | ||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||
| 930 | =item id | ||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||
| 932 | The unique ID within the B<isbndb.com> system for this book. | ||||||||||||||||||||||||||||
| 933 | |||||||||||||||||||||||||||||
| 934 | =item isbn | ||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||
| 936 | The ISBN (International Standard Book Number) for the book (without hyphens). | ||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||
| 938 | =item title | ||||||||||||||||||||||||||||
| 939 | |||||||||||||||||||||||||||||
| 940 | The title of the book. | ||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||
| 942 | =item longtitle | ||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||
| 944 | The full title of the book, including any sub-title. | ||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||
| 946 | =item authors | ||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||
| 948 | An array (stored as a reference) of the B<WebService::ISBNDB::API::Authors> | ||||||||||||||||||||||||||||
| 949 | objects that refer to the authors of the book. These are not actually loaded | ||||||||||||||||||||||||||||
| 950 | from the service until they are first fetched. | ||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||
| 952 | =item authors_text | ||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||
| 954 | A simple textual representation of the authors, as returned by the service. | ||||||||||||||||||||||||||||
| 955 | This may be more convenient to use than the author objects, if you only want | ||||||||||||||||||||||||||||
| 956 | to display the names themselves. | ||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||
| 958 | =item publisher | ||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||
| 960 | The B<WebService::ISBNDB::API::Publisher> object that refers to the book's | ||||||||||||||||||||||||||||
| 961 | publisher. This is not loaded until the first request to fetch it is made. | ||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||
| 963 | =item publisher_text | ||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||
| 965 | A simple textual representation of the publisher, as returned by the service. | ||||||||||||||||||||||||||||
| 966 | This may be more convenient to use than the object, if you only wish to | ||||||||||||||||||||||||||||
| 967 | display the publisher's name. | ||||||||||||||||||||||||||||
| 968 | |||||||||||||||||||||||||||||
| 969 | =item subjects | ||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||
| 971 | An array (stored as a reference) of the B<WebService::ISBNDB::API::Subjects> | ||||||||||||||||||||||||||||
| 972 | objects that refer to the subjects this book is associated with. As with the | ||||||||||||||||||||||||||||
| 973 | authors, the actual objects are not loaded until requested. | ||||||||||||||||||||||||||||
| 974 | |||||||||||||||||||||||||||||
| 975 | =item dewey_decimal | ||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||
| 977 | The book's Dewey Decimal classification number. | ||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||
| 979 | =item dewey_decimal_normalized | ||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||
| 981 | The normalized form of the Dewey Decimal number for the book. | ||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||
| 983 | =item lcc_number | ||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||
| 985 | The Library of Congress Classification number for the book. | ||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||
| 987 | =item language | ||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||
| 989 | The language the book is printed in. The form and content of this field may | ||||||||||||||||||||||||||||
| 990 | not be standardized. | ||||||||||||||||||||||||||||
| 991 | |||||||||||||||||||||||||||||
| 992 | =item physical_description_text | ||||||||||||||||||||||||||||
| 993 | |||||||||||||||||||||||||||||
| 994 | Text describing the physical dimensions of the book. | ||||||||||||||||||||||||||||
| 995 | |||||||||||||||||||||||||||||
| 996 | =item edition_info | ||||||||||||||||||||||||||||
| 997 | |||||||||||||||||||||||||||||
| 998 | Any additional information on the particular edition of the book. | ||||||||||||||||||||||||||||
| 999 | |||||||||||||||||||||||||||||
| 1000 | =item change_time | ||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||
| 1002 | A string representation of the time when this record was last changed. The | ||||||||||||||||||||||||||||
| 1003 | string is in ISO 8601 form, with no explicit time-zone specified. UTC time | ||||||||||||||||||||||||||||
| 1004 | is assumed in internal manipulations. | ||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||
| 1006 | =item change_time_sec | ||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||
| 1008 | If the B<Date::Parse> module is available, this attribute will hold the value | ||||||||||||||||||||||||||||
| 1009 | from C<change_time>, converted to seconds since the UNIX Epoch. Otherwise, | ||||||||||||||||||||||||||||
| 1010 | this attribute will always be C<undef>. | ||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||
| 1012 | =item price_time | ||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||
| 1014 | A string representation of the time when the price information for this | ||||||||||||||||||||||||||||
| 1015 | record was last updated. As above, the string is in ISO 8601 format with no | ||||||||||||||||||||||||||||
| 1016 | time-zone, and it assumed to be UTC internally. | ||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||
| 1018 | =item price_time_sec | ||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||
| 1020 | As with C<change_time_sec>, only for the price-change value. Requires the | ||||||||||||||||||||||||||||
| 1021 | availability of B<Date::Parse>, or else the value will always be C<undef>. | ||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||
| 1023 | =item summary | ||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||
| 1025 | The content of the C<E<lt>SummaryE<gt>> tag, which is free-form text. The | ||||||||||||||||||||||||||||
| 1026 | text has leading and trailing white-space removed, and all new-lines | ||||||||||||||||||||||||||||
| 1027 | converted to spaces, to yield a single-line string value. | ||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||
| 1029 | =item notes | ||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||
| 1031 | Another free-form text field, similar to C<summary>, but less used. | ||||||||||||||||||||||||||||
| 1032 | |||||||||||||||||||||||||||||
| 1033 | =item urlstext | ||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||
| 1035 | Fairly free-form text, used to specify URLs related to the book. | ||||||||||||||||||||||||||||
| 1036 | |||||||||||||||||||||||||||||
| 1037 | =item awardstext | ||||||||||||||||||||||||||||
| 1038 | |||||||||||||||||||||||||||||
| 1039 | More free-form text, this to specify any awards the book has received. | ||||||||||||||||||||||||||||
| 1040 | |||||||||||||||||||||||||||||
| 1041 | =item prices | ||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||
| 1043 | If price information is available for the book, this attribute will contain | ||||||||||||||||||||||||||||
| 1044 | a list-reference containing zero or more hash references. Each hash reference | ||||||||||||||||||||||||||||
| 1045 | will have the following keys (all will be present on every hash reference, but | ||||||||||||||||||||||||||||
| 1046 | some may be empty or C<undef>): | ||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||
| 1048 | =over 8 | ||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||
| 1050 | =item store_isbn | ||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||
| 1052 | The ISBN for the book at the store, if different from the book's regular | ||||||||||||||||||||||||||||
| 1053 | ISBN. Not set if the two are the same. | ||||||||||||||||||||||||||||
| 1054 | |||||||||||||||||||||||||||||
| 1055 | =item store_title | ||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||
| 1057 | The book's title at the store, if different from the book's regular title. | ||||||||||||||||||||||||||||
| 1058 | Not usually set if the two are the same. | ||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||
| 1060 | =item store_url | ||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||
| 1062 | URL for the book. This may be a relative URL, in which case it is relative to | ||||||||||||||||||||||||||||
| 1063 | the store's website. If it is an absolute URL (complete URL), it is a | ||||||||||||||||||||||||||||
| 1064 | redirector URL originating at B<isbndb.com>. The URL is used for purchasing | ||||||||||||||||||||||||||||
| 1065 | the book, and the redirect URLs allow B<isbndb.com> to collect small | ||||||||||||||||||||||||||||
| 1066 | commissions off of sales they facilitate, which in turn helps to keep their | ||||||||||||||||||||||||||||
| 1067 | service available and free. | ||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||
| 1069 | =item store_id | ||||||||||||||||||||||||||||
| 1070 | |||||||||||||||||||||||||||||
| 1071 | Unique identifier for the store. | ||||||||||||||||||||||||||||
| 1072 | |||||||||||||||||||||||||||||
| 1073 | =item currency_code | ||||||||||||||||||||||||||||
| 1074 | |||||||||||||||||||||||||||||
| 1075 | The code for the currency the price is expressed in. | ||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||
| 1077 | =item is_in_stock | ||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||
| 1079 | A boolean value indicating whether the book is in stock. | ||||||||||||||||||||||||||||
| 1080 | |||||||||||||||||||||||||||||
| 1081 | =item is_historic | ||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||
| 1083 | A boolean value indicating whether the price this record describes is | ||||||||||||||||||||||||||||
| 1084 | considered "historic". Any price older than 24 hours should generally be | ||||||||||||||||||||||||||||
| 1085 | considered historic, even if this value is true. | ||||||||||||||||||||||||||||
| 1086 | |||||||||||||||||||||||||||||
| 1087 | =item is_new | ||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||
| 1089 | A boolean value indicating whether the book offered is new or used. | ||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||
| 1091 | =item currency_rate | ||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||
| 1093 | Currency rate against the US dollar, only set if the C<currency_code> is not | ||||||||||||||||||||||||||||
| 1094 | C<USD>. | ||||||||||||||||||||||||||||
| 1095 | |||||||||||||||||||||||||||||
| 1096 | =item price | ||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||
| 1098 | The price of the book (expressed in the currency indicated by C<currency_code>, | ||||||||||||||||||||||||||||
| 1099 | above). | ||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||
| 1101 | =item check_time | ||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||
| 1103 | String representation of the time when this price was last checked. As with | ||||||||||||||||||||||||||||
| 1104 | the other time-oriented values, this is in ISO 8601 format with no explicit | ||||||||||||||||||||||||||||
| 1105 | time-zone. | ||||||||||||||||||||||||||||
| 1106 | |||||||||||||||||||||||||||||
| 1107 | =item check_time_sec | ||||||||||||||||||||||||||||
| 1108 | |||||||||||||||||||||||||||||
| 1109 | If the B<Date::Parse> package is available, this is the value of C<check_time> | ||||||||||||||||||||||||||||
| 1110 | expressed in seconds, suitable for use with the Perl B<localtime> keyword. | ||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||
| 1112 | =back | ||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||
| 1114 | =item marc | ||||||||||||||||||||||||||||
| 1115 | |||||||||||||||||||||||||||||
| 1116 | If MARC information is available for the book, this attribute will contain | ||||||||||||||||||||||||||||
| 1117 | a list-reference containing zero or more hash references. Each hash reference | ||||||||||||||||||||||||||||
| 1118 | will have the following keys (all will be present on every hash reference, but | ||||||||||||||||||||||||||||
| 1119 | some may be empty or C<undef>): | ||||||||||||||||||||||||||||
| 1120 | |||||||||||||||||||||||||||||
| 1121 | =over 8 | ||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||
| 1123 | =item library_name | ||||||||||||||||||||||||||||
| 1124 | |||||||||||||||||||||||||||||
| 1125 | Name of the library this record is taken from. | ||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||
| 1127 | =item last_update | ||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||
| 1129 | ISO 8601 string representing the last time the record was updated from the | ||||||||||||||||||||||||||||
| 1130 | library. | ||||||||||||||||||||||||||||
| 1131 | |||||||||||||||||||||||||||||
| 1132 | =item last_update_sec | ||||||||||||||||||||||||||||
| 1133 | |||||||||||||||||||||||||||||
| 1134 | If B<Date::Parse> is available, this will be the C<last_update> attribute | ||||||||||||||||||||||||||||
| 1135 | converted to seconds, measured from the UNIX epoch. | ||||||||||||||||||||||||||||
| 1136 | |||||||||||||||||||||||||||||
| 1137 | =item marc_url | ||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||
| 1139 | The URL to the MARC record on the library's site. | ||||||||||||||||||||||||||||
| 1140 | |||||||||||||||||||||||||||||
| 1141 | =back | ||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||
| 1143 | =back | ||||||||||||||||||||||||||||
| 1144 | |||||||||||||||||||||||||||||
| 1145 | The following accessors are provided to manage these attributes: | ||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||
| 1147 | =over 4 | ||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||
| 1149 | =item get_id | ||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||
| 1151 | Return the book ID. | ||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||
| 1153 | =item set_id($ID) | ||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||
| 1155 | Sets the book ID. This method is restricted to this class, and cannot be | ||||||||||||||||||||||||||||
| 1156 | called outside of it. In general, you shouldn't need to set the ID after the | ||||||||||||||||||||||||||||
| 1157 | object is created, since B<isbndb.com> is a read-only source. | ||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||
| 1159 | =item get_isbn | ||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||
| 1161 | Return the ISBN of the book. In general, the ISBN has had any hyphens removed. | ||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||
| 1163 | =item set_isbn($ISBN) | ||||||||||||||||||||||||||||
| 1164 | |||||||||||||||||||||||||||||
| 1165 | Set the book ISBN. The value is tested with B<Business::ISBN> to ensure that | ||||||||||||||||||||||||||||
| 1166 | the value is a valid ISBN. | ||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||
| 1168 | =item get_title | ||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||
| 1170 | Return the common title of the book. | ||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||
| 1172 | =item set_title($TITLE) | ||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||
| 1174 | Set the title of the book. | ||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||
| 1176 | =item get_longtitle | ||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||
| 1178 | Return the long title of the book. This will include subtitles, for example. | ||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||
| 1180 | =item set_longtitle($LONGTITLE) | ||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||
| 1182 | Set the long title of the book. | ||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||
| 1184 | =item get_authors | ||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||
| 1186 | Get the list of author objects (instances of | ||||||||||||||||||||||||||||
| 1187 | B<WebService::ISBNDB::API::Authors> or a sub-class) for the book. The objects | ||||||||||||||||||||||||||||
| 1188 | are not fetched from the source until the first call to this method. | ||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||
| 1190 | =item set_authors($LIST) | ||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||
| 1192 | Set the list of authors for this book. The value must be a list-reference. If | ||||||||||||||||||||||||||||
| 1193 | the values in the list reference are strings instead of objects, then the | ||||||||||||||||||||||||||||
| 1194 | first call to get_authors() will convert them into objects. The strings must | ||||||||||||||||||||||||||||
| 1195 | be the author ID values as returned by the service. | ||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||
| 1197 | =item get_authors_text | ||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||
| 1199 | Return the text-representation of the authors, as returned by the service. | ||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||
| 1201 | =item set_authors_text($TEXT) | ||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||
| 1203 | Set the text-representation of the authors. | ||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||
| 1205 | =item get_publisher | ||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||
| 1207 | Return the publisher object (instance of | ||||||||||||||||||||||||||||
| 1208 | B<WebService::ISBNDB::API::Publishers> or a sub-class) for this book. The | ||||||||||||||||||||||||||||
| 1209 | object is not loaded from the source until the first request to this method. | ||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||
| 1211 | =item set_publisher($PUBLISHER) | ||||||||||||||||||||||||||||
| 1212 | |||||||||||||||||||||||||||||
| 1213 | Set the publisher for this book. The value should be either a publisher object | ||||||||||||||||||||||||||||
| 1214 | or a string containing the publisher ID. If the ID is set as the value, the | ||||||||||||||||||||||||||||
| 1215 | next call to get_publisher() will resolve it into an object. | ||||||||||||||||||||||||||||
| 1216 | |||||||||||||||||||||||||||||
| 1217 | =item get_subjects | ||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||
| 1219 | Get the list of subject objects (instances of | ||||||||||||||||||||||||||||
| 1220 | B<WebService::ISBNDB::API::Subjects> or a sub-class) for the book. The objects | ||||||||||||||||||||||||||||
| 1221 | are not fetched from the source until the first call to this method. | ||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||
| 1223 | =item set_subjects($LIST) | ||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||
| 1225 | Set the list of subjects. The value must be a list-reference, and may contain | ||||||||||||||||||||||||||||
| 1226 | either the objects themselves or the subject ID values as returned by the | ||||||||||||||||||||||||||||
| 1227 | source. If the content is the ID values, then the next call to get_subjects() | ||||||||||||||||||||||||||||
| 1228 | will resolve them to objects. | ||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||
| 1230 | =item get_dewey_decimal | ||||||||||||||||||||||||||||
| 1231 | |||||||||||||||||||||||||||||
| 1232 | Get the Dewey Decimal number. | ||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||
| 1234 | =item set_dewey_decimal($DEWEY) | ||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||
| 1236 | Set the Dewey Decimal number. | ||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||
| 1238 | =item get_dewey_decimal_normalized | ||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||
| 1240 | Get the normalized Dewey Decimal number. | ||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||
| 1242 | =item set_dewey_decimal_normalized($DEWEY_NORM) | ||||||||||||||||||||||||||||
| 1243 | |||||||||||||||||||||||||||||
| 1244 | Set the normalized Dewey Decimal number. | ||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||
| 1246 | =item get_lcc_number | ||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||
| 1248 | Get the Library of Congress Classification number. | ||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||
| 1250 | =item set_lcc_number($LCC) | ||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||
| 1252 | Set the Library of Congress Classification number. | ||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||
| 1254 | =item get_language | ||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||
| 1256 | Get the language code for the book's text. | ||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||
| 1258 | =item set_language($LANG) | ||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||
| 1260 | Set the language code. | ||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||
| 1262 | =item get_physical_description_text | ||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||
| 1264 | Get the book's physical description text. | ||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||
| 1266 | =item set_physical_description_text($PHYS) | ||||||||||||||||||||||||||||
| 1267 | |||||||||||||||||||||||||||||
| 1268 | Set the book's physical description text. | ||||||||||||||||||||||||||||
| 1269 | |||||||||||||||||||||||||||||
| 1270 | =item get_edition_info | ||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||
| 1272 | Get any information on the specific edition of the book. | ||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||
| 1274 | =item set_edition_info($INFO) | ||||||||||||||||||||||||||||
| 1275 | |||||||||||||||||||||||||||||
| 1276 | Set the edition information for the book. | ||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||
| 1278 | =item get_change_time | ||||||||||||||||||||||||||||
| 1279 | |||||||||||||||||||||||||||||
| 1280 | Get the change-time of the book record (an ISO 8601 string, no explicit | ||||||||||||||||||||||||||||
| 1281 | time-zone, presumed to be UTC). | ||||||||||||||||||||||||||||
| 1282 | |||||||||||||||||||||||||||||
| 1283 | =item set_change_time($TIME) | ||||||||||||||||||||||||||||
| 1284 | |||||||||||||||||||||||||||||
| 1285 | Sets the change-time of the book record. If B<Parse::Date> is available, and | ||||||||||||||||||||||||||||
| 1286 | the value passed in C<$TIME> is parsable, then the C<change_time_sec> | ||||||||||||||||||||||||||||
| 1287 | attribute will also be updated with the equivalent value. | ||||||||||||||||||||||||||||
| 1288 | |||||||||||||||||||||||||||||
| 1289 | =item get_change_time_sec | ||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||
| 1291 | Get the change-time as a number of seconds since the Epoch (as defined in | ||||||||||||||||||||||||||||
| 1292 | UNIX terms, see L<Parse::Date>). This attribute is only set if the | ||||||||||||||||||||||||||||
| 1293 | B<Date::Parse> module is available. | ||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||
| 1295 | =item set_change_time_sec($TIME) | ||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||
| 1297 | Set the seconds-since-Epoch representation of the change-time to the new | ||||||||||||||||||||||||||||
| 1298 | value. This will also update the C<change_time> attribute, setting it to an | ||||||||||||||||||||||||||||
| 1299 | ISO 8601-style string that is the textual representation of C<$TIME>. | ||||||||||||||||||||||||||||
| 1300 | |||||||||||||||||||||||||||||
| 1301 | =item get_price_time | ||||||||||||||||||||||||||||
| 1302 | |||||||||||||||||||||||||||||
| 1303 | =item set_price_time($TIME) | ||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||
| 1305 | =item get_price_time_sec | ||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||
| 1307 | =item set_price_time_sec($TIME) | ||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||
| 1309 | These are identical to the previous four, only they apply to the time-stamp | ||||||||||||||||||||||||||||
| 1310 | marking when the price information was last updated. The same restrictions | ||||||||||||||||||||||||||||
| 1311 | apply to the C<price_time_sec> attribute (B<Parse::Date> is required for it | ||||||||||||||||||||||||||||
| 1312 | to be set when data is read from the source). | ||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||
| 1314 | =item get_summary | ||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||
| 1316 | Get the summary text for this book. The summary is free-form text that has | ||||||||||||||||||||||||||||
| 1317 | has leading and trailing white-space removed, as well as having any internal | ||||||||||||||||||||||||||||
| 1318 | new-lines or tabs converted to single spaces. | ||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||
| 1320 | =item set_summary($SUMMARY) | ||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||
| 1322 | Set the summary text to the new content in C<$SUMMARY>. | ||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||
| 1324 | =item get_notes | ||||||||||||||||||||||||||||
| 1325 | |||||||||||||||||||||||||||||
| 1326 | Get the notes for the book. The notes are also free-form text, and are | ||||||||||||||||||||||||||||
| 1327 | trimmed in the same fashion as C<summary>. | ||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||
| 1329 | =item set_notes($NOTES) | ||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||
| 1331 | Set the notes text for the book. | ||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||
| 1333 | =item get_urlstext | ||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||
| 1335 | Get the C<urlstext> attribute. This text should provide URLs related to | ||||||||||||||||||||||||||||
| 1336 | the book, when present. | ||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||
| 1338 | =item set_urlstext($URLS) | ||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||
| 1340 | Set the C<urlstext> attribute to the new value. | ||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||
| 1342 | =item get_awardstext | ||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||
| 1344 | Get the awards-text data for the book. If present, this should refer to any | ||||||||||||||||||||||||||||
| 1345 | awards the book has won. | ||||||||||||||||||||||||||||
| 1346 | |||||||||||||||||||||||||||||
| 1347 | =item set_awardstext($AWARDS) | ||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||
| 1349 | Set the awards-text to the new data given. | ||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||
| 1351 | =item get_prices | ||||||||||||||||||||||||||||
| 1352 | |||||||||||||||||||||||||||||
| 1353 | Get the price data for the book. This comes in the form of a list-reference | ||||||||||||||||||||||||||||
| 1354 | of hash-references (see earlier description of the keys). | ||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||
| 1356 | =item set_prices($PRICELIST) | ||||||||||||||||||||||||||||
| 1357 | |||||||||||||||||||||||||||||
| 1358 | Set the price data. The value passed in must be a list reference, and every | ||||||||||||||||||||||||||||
| 1359 | element in the list mush be a hash reference. Otherwise an exception will be | ||||||||||||||||||||||||||||
| 1360 | thrown. | ||||||||||||||||||||||||||||
| 1361 | |||||||||||||||||||||||||||||
| 1362 | =item get_marc | ||||||||||||||||||||||||||||
| 1363 | |||||||||||||||||||||||||||||
| 1364 | Get the MARC data for the book. MARC data comes in the form of a | ||||||||||||||||||||||||||||
| 1365 | list-reference of hash-references (see above for description of the keys). | ||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||
| 1367 | =item set_marc($MARCLIST) | ||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||
| 1369 | Set the MARC data. The value passed in must be a list reference, and every | ||||||||||||||||||||||||||||
| 1370 | element in the list mush be a hash reference. Otherwise an exception will be | ||||||||||||||||||||||||||||
| 1371 | thrown. | ||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||
| 1373 | =back | ||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||
| 1375 | =head2 Utility Methods | ||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||
| 1377 | Besides the constructor and the accessors, the following methods are provided | ||||||||||||||||||||||||||||
| 1378 | for utility: | ||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||
| 1380 | =over 4 | ||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||
| 1382 | =item find($ARG|$ARGS) | ||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||
| 1384 | This is a specialization of find() from the parent class. It allows the | ||||||||||||||||||||||||||||
| 1385 | argument passed in to be a scalar in place of the usual hash reference. If the | ||||||||||||||||||||||||||||
| 1386 | value is a scalar, it is tested to see if it is a valid ISBN, and if so the | ||||||||||||||||||||||||||||
| 1387 | search is made against the ISBN with that value. If the scalar value is not a | ||||||||||||||||||||||||||||
| 1388 | valid ISBN, the search is made against the title instead. If the value is a | ||||||||||||||||||||||||||||
| 1389 | hash reference, it is passed to the super-class method. | ||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||
| 1391 | =item normalize_args($ARGS) | ||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||
| 1393 | This method maps the user-visible arguments as defined for find() and search() | ||||||||||||||||||||||||||||
| 1394 | into the actual arguments that must be passed to the service itself. In | ||||||||||||||||||||||||||||
| 1395 | addition, some arguments are added to the request to make the service return | ||||||||||||||||||||||||||||
| 1396 | extra data used for retrieving subjects, publisher information, etc. The | ||||||||||||||||||||||||||||
| 1397 | method changes C<$ARGS> in place, and also returns C<$ARGS> as the value from | ||||||||||||||||||||||||||||
| 1398 | the method. | ||||||||||||||||||||||||||||
| 1399 | |||||||||||||||||||||||||||||
| 1400 | =back | ||||||||||||||||||||||||||||
| 1401 | |||||||||||||||||||||||||||||
| 1402 | See the next section for an explanation of the available keys for searches. | ||||||||||||||||||||||||||||
| 1403 | |||||||||||||||||||||||||||||
| 1404 | =head1 SEARCHING | ||||||||||||||||||||||||||||
| 1405 | |||||||||||||||||||||||||||||
| 1406 | Both find() and search() allow the user to look up data in the B<isbndb.com> | ||||||||||||||||||||||||||||
| 1407 | database. The allowable search fields are limited to a certain set, however. | ||||||||||||||||||||||||||||
| 1408 | When either of find() or search() are called, the argument to the method | ||||||||||||||||||||||||||||
| 1409 | should be a hash reference of key/value pairs to be passed as arguments for | ||||||||||||||||||||||||||||
| 1410 | the search (the exception being that find() can accept a single string, which | ||||||||||||||||||||||||||||
| 1411 | has special meaning as detailed earlier). | ||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||
| 1413 | Searches in the text fields are done in a case-insensitive manner. | ||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||
| 1415 | The available search keys are: | ||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||
| 1417 | =over 4 | ||||||||||||||||||||||||||||
| 1418 | |||||||||||||||||||||||||||||
| 1419 | =item title | ||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||
| 1421 | The value should be a text string. The search returns books whose title | ||||||||||||||||||||||||||||
| 1422 | matches the string. | ||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||
| 1424 | =item isbn | ||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||
| 1426 | The value should be a text string. The search returns the book whose ISBN | ||||||||||||||||||||||||||||
| 1427 | matches the string. The string is not checked for validity, so a bad ISBN | ||||||||||||||||||||||||||||
| 1428 | will simply not return any records. | ||||||||||||||||||||||||||||
| 1429 | |||||||||||||||||||||||||||||
| 1430 | =item author | ||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||
| 1432 | The value for this key should be either an object of the | ||||||||||||||||||||||||||||
| 1433 | B<WebService::ISBNDB::API::Authors> class (or sub-class thereof), or a text | ||||||||||||||||||||||||||||
| 1434 | string. If the value is an object, the search is done against the specific | ||||||||||||||||||||||||||||
| 1435 | author ID. If the value is a string, the search is done using the "combined" | ||||||||||||||||||||||||||||
| 1436 | search key, and may return results unrelated to the intended query. | ||||||||||||||||||||||||||||
| 1437 | |||||||||||||||||||||||||||||
| 1438 | =item publisher | ||||||||||||||||||||||||||||
| 1439 | |||||||||||||||||||||||||||||
| 1440 | The value for this key may be an object of the | ||||||||||||||||||||||||||||
| 1441 | B<WebService::ISBNDB::API::Publishers> class (or sub-class thereof) or a text | ||||||||||||||||||||||||||||
| 1442 | string. If it is an object, the ID is used in a specific search. If the value | ||||||||||||||||||||||||||||
| 1443 | is a string, it is used with the "combined" search-key, and may return | ||||||||||||||||||||||||||||
| 1444 | unexpected results. | ||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||
| 1446 | =item subject | ||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||
| 1448 | The value for this key is expected to be either an object (of the | ||||||||||||||||||||||||||||
| 1449 | B<WebService::ISBNDB::API::Subjects> class or sub-class thereof) or a literal | ||||||||||||||||||||||||||||
| 1450 | subject ID as a string. The subject cannot be searched for using the | ||||||||||||||||||||||||||||
| 1451 | "combined" key. | ||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||
| 1453 | =item combined | ||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||
| 1455 | The value should be a text string, and is searched against a combined field | ||||||||||||||||||||||||||||
| 1456 | that includes titles, authors and publisher names. | ||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||
| 1458 | =item full | ||||||||||||||||||||||||||||
| 1459 | |||||||||||||||||||||||||||||
| 1460 | The value should be a text string, and is searched against almost all of the | ||||||||||||||||||||||||||||
| 1461 | textual data, including title, authors, publishers, summary, notes, award | ||||||||||||||||||||||||||||
| 1462 | information, etc. | ||||||||||||||||||||||||||||
| 1463 | |||||||||||||||||||||||||||||
| 1464 | =item dewey_decimal | ||||||||||||||||||||||||||||
| 1465 | |||||||||||||||||||||||||||||
| 1466 | The value should be a Dewey Decimal Classification number, and is used | ||||||||||||||||||||||||||||
| 1467 | directly in the search. | ||||||||||||||||||||||||||||
| 1468 | |||||||||||||||||||||||||||||
| 1469 | =item lcc_number | ||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||
| 1471 | The value should be a Library of Congress Classification number, and is used | ||||||||||||||||||||||||||||
| 1472 | directly in the search. | ||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||
| 1474 | =back | ||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||
| 1476 | Note that the names above may not be the same as the corresponding parameters | ||||||||||||||||||||||||||||
| 1477 | to the service. The names are chosen to match the related attributes as | ||||||||||||||||||||||||||||
| 1478 | closely as possible, for ease of understanding. | ||||||||||||||||||||||||||||
| 1479 | |||||||||||||||||||||||||||||
| 1480 | =head1 EXAMPLES | ||||||||||||||||||||||||||||
| 1481 | |||||||||||||||||||||||||||||
| 1482 | Search for all books with "perl" in the title: | ||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||
| 1484 | $perlbooks = WebService::ISBNDB::API::Books-> | ||||||||||||||||||||||||||||
| 1485 | search({ title => "perl" }); | ||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||
| 1487 | Search for all books by Edgar Allan Poe: | ||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||
| 1489 | $poebooks = WebService::ISBNDB::API::Books-> | ||||||||||||||||||||||||||||
| 1490 | search({ author => 'edgar allan poe' }); | ||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||
| 1492 | Find the record for "Progamming Web Services With Perl": | ||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||
| 1494 | $pwswp = WebService::ISBNDB::API::Books->find('0596002068'); | ||||||||||||||||||||||||||||
| 1495 | |||||||||||||||||||||||||||||
| 1496 | =head1 CAVEATS | ||||||||||||||||||||||||||||
| 1497 | |||||||||||||||||||||||||||||
| 1498 | The data returned by this class is only as accurate as the data retrieved from | ||||||||||||||||||||||||||||
| 1499 | B<isbndb.com>. | ||||||||||||||||||||||||||||
| 1500 | |||||||||||||||||||||||||||||
| 1501 | The list of results from calling search() is currently limited to 10 items. | ||||||||||||||||||||||||||||
| 1502 | This limit will be removed in an upcoming release, when iterators are | ||||||||||||||||||||||||||||
| 1503 | implemented. | ||||||||||||||||||||||||||||
| 1504 | |||||||||||||||||||||||||||||
| 1505 | =head1 SEE ALSO | ||||||||||||||||||||||||||||
| 1506 | |||||||||||||||||||||||||||||
| 1507 | L<WebService::ISBNDB::API>, L<WebService::ISBNDB::API::Authors>, | ||||||||||||||||||||||||||||
| 1508 | L<WebService::ISBNDB::API::Publishers>, L<WebService::ISBNDB::API::Subjects>, | ||||||||||||||||||||||||||||
| 1509 | L<Business::ISBN>, L<Date::Parse> | ||||||||||||||||||||||||||||
| 1510 | |||||||||||||||||||||||||||||
| 1511 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 1512 | |||||||||||||||||||||||||||||
| 1513 | Randy J. Ray E<lt>rjray@blackperl.comE<gt> | ||||||||||||||||||||||||||||
| 1514 | |||||||||||||||||||||||||||||
| 1515 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 1516 | |||||||||||||||||||||||||||||
| 1517 | This module and the code within are | ||||||||||||||||||||||||||||
| 1518 | released under the terms of the Artistic License 2.0 | ||||||||||||||||||||||||||||
| 1519 | (http://www.opensource.org/licenses/artistic-license-2.0.php). This | ||||||||||||||||||||||||||||
| 1520 | code may be redistributed under either the Artistic License or the GNU | ||||||||||||||||||||||||||||
| 1521 | Lesser General Public License (LGPL) version 2.1 | ||||||||||||||||||||||||||||
| 1522 | (http://www.opensource.org/licenses/lgpl-license.php). | ||||||||||||||||||||||||||||
| 1523 | |||||||||||||||||||||||||||||
| 1524 | =cut | ||||||||||||||||||||||||||||