First here is some debugging code:

#!/usr/bin/perl -w use CGI; use CGI::Carp qw(fatalsToBrowser); use lib '/home/samn/cgi-bin/lib/'; use Net::AIM; use Data::Dumper; # preove that the module is listening ;-) # print "Content-type: text/html\n\nNet::AIM Version: ", $Net::AIM::VE +RSION; # exit; $aim = new Net::AIM; $conn = $aim->newconn(Screenname => 'Robotskull', Password => 'passwor +d'); # check our objects using Data::Dumper (need to escape HTML, pre tag e +tc) #$q = new CGI; #my $data = Dumper ($aim , $conn); #$data = $q->escapeHTML($data); #print $q->header, "<pre>$data</pre>"; #exit; $conn->set_handler('im_in',\&on_im); $aim->start; sub on_im { my ($self, $event) = @_; my ($nick) = $event->from; print $event->dump; my @args = $event->args; $self->send_im($nick, "Hi $nick. You said: $args[2]"); }

Note as I suggested you only need to use lib '/home/samn/cgi-bin/lib/' although you can be more explicit you don't need to be as @INC contains . /lib/site_perl/5.6.0 and /site/lib/site_perl/5.6.0 and will check all those paths. See my A Guide to Installing Modules tutorial for details.

Uncomment the debugging code one bit at a time. The first bit proves you have the module as it can find the $VERSION but as I explained we know that because the error message comes from the module.

Next uncomment the Dumper part

Note that while $aim looks like an object $conn does not. It looks like a 1 to me. Hmmm methinks error in the newconn() method.

Go to the newconn() sub in Net::AIM

Note that instead of returning $conn it returns 1. This is a bug in the software and I have no idea how the author could have failed to notice because the module will not work until you fix it.

Patch the sub like this:

sub newconn { my $self = shift; my $conn = $self->{_conn} = Net::AIM::Connection->new($self, @_); return undef if $conn->error; # return 1; # bzzt, we need to return the object return $conn; }

GOK if the rest of it works, it now hangs for me with no errors which I guess is good given the lack of code. Note that contrary to the advice above Net::AIM uses Net::AIM::Connection so you don't need to access it directly as suggested.

Finally email the author with the patch being as rude as you feel like (depends if the rest of it works :-)

cheers

tachyon

s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print


In reply to Re: Net::AIM by tachyon
in thread [untitled node, ID 165538] by Samn

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.