NAME

Net::UPCDatabase - Simple OO interface to UPCDatabase.com

SYNOPSIS

use Net::UPCDatabase;
my $upcdb = Net::UPCDatabase->new;
my $upc = '035000764119';
my $item = $upcdb->lookup($upc);

if ($item->{error}) {
  print "Error: $item->{error}\n";
}
else {
  print "UPC: $item->{upc}\n";
  print "Product: $item->{description}\n";
  print "Size: $item->{size}\n";
}

DESCRIPTION

Connects to UPCDatabase.com to get information about a given UPC.

FUNCTIONS

new

$upcObject = Net::UPCDatabase->new;

or

$upcObject = Net::UPCDatabase->new($aDifferentUrlThanDefault);

Accepts an OPTIONAL argument, a URL to use instead of the default. Unless you're really sure what you're doing, don't give it a URL. It defaults to 'http://www.upcdatabase.com/rpc', which is probably the right thing.

Returns the object.

lookup

$itemInfo = $upcObject->lookup($upc);

Accepts a REQUIRED argument, the UPC to lookup.

Returns the data about the given UPC in a hash reference.

On error, it returns the given error reason as $itemInfo->{error}.

REQUIRES

RPC::XML RPC::XML::Client

TODO

UPC checksum checking/creation

Make use of the checksum function via UPCDatabase's API.

Better documentation

Is the documentation really ever good enough?

SEE ALSO

http://www.upcdatabase.com/

AUTHOR

Dusty Wilson, <cpan-Net-UPCDatabase@dusty.hey.nu>

COPYRIGHT AND LICENSE

Copyright 2005 by Dusty Wilson

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.