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:

#!/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);
Data::Dumper returns:
$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.

—Brad
"The important work of moving the world forward does not wait to be done by perfect men." George Eliot

In reply to Understanding how to *use* a CPAN module by bradcathey

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.