|
|
|
User Rating: Rated by: |
Good (3.1/5) 19 user(s) |
|
|
|
Tesco Barcode Search description |
|
|
Tesco Barcode Search is a small script which will search the tesco.com online grocery site for a given barcode and return the da Tesco Barcode Search is a small script which will search the tesco.com online grocery site for a given barcode and return the data to the console.
As part of what appears to be an obsessive saga - the short but sweet Tesco script has now been modularized, which has also allowed (thanks entirely to the SOAP::Lite collection of modules) for the swift development of a SOAP WebService, which should mean that interfacing with this script is a whole lot easier for anyone using /other/ languages which in turn means - searching tesco.com for barcodes has just become accessible from pretty much any language that’ll happily communicate with the SOAP::Lite webservice handler.
I’m making the module code available below.
Should you want to deploy this as a web service for your own projects and run it within your own environment the next FOUR lines (how preciously succinct perl is) of perl will do the job:
#!/usr/bin/perl use SOAP::Transport::HTML; use Tesco; # assuming the Tesco.pm file is in the same directory
SOAP::Transport::HTTP::CGI->dispatch_to(’Tesco’)->handle; Save that out within your webroot, here’s some sample client code (again using perl):
Here’s a sample client using SOAP::Lite #!/usr/bin/perl use Data::Dumper; use SOAP::Lite; my $tesco = SOAP::Lite -> uri(’Tesco’) -> proxy(’http://path/to/the/script/featured/above’); print Dumper $tesco->searchBarcode($TESCOUSER, $TESCOPASS, $BARCODE)->result;
I’m quite keen to hear from anyone using other languages who’d like to test this (any C# developers want to try adding this as a Web Reference?), drop me a line if you’d like access to the web service I have running.
For those who simply wish to use the module from within Perl, it’s as easy as:
#!/usr/bin/perl -w use Tesco qw( searchBarcode ); my ($productname, $shelf, $price, $barcode) = searchBarcode($TESCOUSER, $TESCOPASS, $BARCODE);
As this is still a work in progress (read: I’ve just done the entertaining stuff so far), it’s somewhat lacking….
For example - there is no error checking, need I go on? Feature wise, this is pretty much it, so I’ll get it fixed up with some of that precious error checking and call it a day with this project.
What's New in This Release:
· The Perl code is now modularized, allowing for the integration of barcode searches from within your own Perl scripts. · The Web site also includes information about the creation of a SOAP Web service, allowing the use of this code from other languages.
|
|