Lines 50-75
sub initialize {
Link Here
|
50 |
#"Mozilla/4.76 [en] (Win98; U)", # if for some reason you want to go stealth, you might prefer this |
50 |
#"Mozilla/4.76 [en] (Win98; U)", # if for some reason you want to go stealth, you might prefer this |
51 |
} |
51 |
} |
52 |
|
52 |
|
53 |
sub image_url (;$) { |
53 |
sub image_url { |
54 |
($user and $pass) or return undef; |
54 |
($user and $pass) or return; |
55 |
my $isbn = (@_ ? shift : ''); |
55 |
my $isbn = (@_ ? shift : ''); |
56 |
$isbn =~ s/(p|-)//g; # sanitize |
56 |
$isbn =~ s/(p|-)//g; # sanitize |
57 |
return $image_url . $isbn; |
57 |
return $image_url . $isbn; |
58 |
} |
58 |
} |
59 |
sub link_url (;$) { |
59 |
sub link_url { |
60 |
my $isbn = (@_ ? shift : ''); |
60 |
my $isbn = (@_ ? shift : ''); |
61 |
$isbn =~ s/(p|-)//g; # sanitize |
61 |
$isbn =~ s/(p|-)//g; # sanitize |
62 |
$link_url or return undef; |
62 |
$link_url or return; |
63 |
return $link_url . $isbn; |
63 |
return $link_url . $isbn; |
64 |
} |
64 |
} |
65 |
sub content_cafe_url ($) { |
65 |
sub content_cafe_url { |
66 |
($user and $pass) or return undef; |
66 |
($user and $pass) or return; |
67 |
my $isbn = (@_ ? shift : ''); |
67 |
my $isbn = (@_ ? shift : ''); |
68 |
$isbn =~ s/(p|-)//g; # sanitize |
68 |
$isbn =~ s/(p|-)//g; # sanitize |
69 |
return "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$user&Password=$pass&Options=Y&ItemKey=$isbn"; |
69 |
return "http://contentcafe2.btol.com/ContentCafeClient/ContentCafe.aspx?UserID=$user&Password=$pass&Options=Y&ItemKey=$isbn"; |
70 |
} |
70 |
} |
71 |
sub http_jacket_link ($) { |
71 |
sub http_jacket_link { |
72 |
my $isbn = shift or return undef; |
72 |
my $isbn = shift or return; |
73 |
$isbn =~ s/(p|-)//g; # sanitize |
73 |
$isbn =~ s/(p|-)//g; # sanitize |
74 |
my $image = availability($isbn); |
74 |
my $image = availability($isbn); |
75 |
my $alt = "Buy this book"; |
75 |
my $alt = "Buy this book"; |
Lines 79-87
sub http_jacket_link ($) {
Link Here
|
79 |
return sprintf qq(<a class="btlink" href="%s">%s</a>),$link,($image||$alt); |
79 |
return sprintf qq(<a class="btlink" href="%s">%s</a>),$link,($image||$alt); |
80 |
} |
80 |
} |
81 |
|
81 |
|
82 |
sub availability ($) { |
82 |
sub availability { |
83 |
my $isbn = shift or return undef; |
83 |
my $isbn = shift or return; |
84 |
($user and $pass) or return undef; |
84 |
($user and $pass) or return; |
85 |
$isbn =~ s/(p|-)//g; # sanitize |
85 |
$isbn =~ s/(p|-)//g; # sanitize |
86 |
my $url = "http://contentcafe2.btol.com/ContentCafe/InventoryAvailability.asmx/CheckInventory?UserID=$user&Password=$pass&Value=$isbn"; |
86 |
my $url = "http://contentcafe2.btol.com/ContentCafe/InventoryAvailability.asmx/CheckInventory?UserID=$user&Password=$pass&Value=$isbn"; |
87 |
$debug and warn __PACKAGE__ . " request:\n$url\n"; |
87 |
$debug and warn __PACKAGE__ . " request:\n$url\n"; |
88 |
- |
|
|