Fellow Monastians,
Usually we hear about people's problems installing CPAN modules. This is a higher-view question about using a module. And I'm sure it will come down to a weak grasp of OO concepts (which I do admit, still seem magical to me), but I'm hoping that by asking this question, it will help understand both.
Of course, as a big proponent of CGI::Application I use lots of modules, but I'm having a major disconnect with one that I had installed yesterday (thank you tirwhan), WebService::ISBNDB::API. This module pulls in information from http://www.isbndb.com about any book in print, or so it seems. My goal is have a user input an ISBN number, have this module fetch the record from the service, and then populate a MySQL table by parsing the returned data about that book (I apologize if I'm not using the correct verbs). Simple enough. But here's a test:
Data::Dumper returns:#!/usr/bin/perl use strict; use CGI::Carp qw(fatalsToBrowser); use Data::Dumper; use WebService::ISBNDB::API::Books; my $book = WebService::ISBNDB::API->new(); my $result = WebService::ISBNDB::API::Books->search( { api_key => '6B5 +XBPOQ', isbn => '059600 +2068' } ); # thought I woul +d need $book somewhere here print "Content-type: text/plain\n\n"; print Dumper($result);
$VAR1 = bless( do{\(my $o = undef)}, 'WebService::ISBNDB::Iterator' );
I thought it would return a hash with all the data about that book. And then I would use methods (the doc talks about objects, attributes and accessors) like:
my $title = $result->get_title();
to pick out specific fields. Granted, the module use Class::Std, which I don't get either. Bottomline, I just want the entire record for the book returned and then be able to extract the data I need. Are there universal principles I should know about using CPAN modules, or is this one different? Thanks in advance for your help.
In reply to Understanding how to *use* a CPAN module by bradcathey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |