First off, your code won't even compile - this may be because there were some mistakes transfering to the browser, I dunno. You're missing the right curlie to end the on_public sub. Second, your code has no indentation and declares some subs in the middle. Now, we can argue about sub declaration all we want, (and frankly, you can do it however you want, and since they are handlers it is probably reasonable) but some indenting, however you choose to do it, would make life easier. :-)

Now, your first problem is with the module - it is what fails. Now if a connection isn't made, then $conn isn't an object - that's your second problem. This is why add_handler won't work - the connection fails, so the return isn't a connection object. I don't know why it fails - Net::IRC is called a work in progress. Try loading a fresh copy of the module and it's friends and try it all again. If that doesn't work, send a bug report to the author.

Cheers,
Erik

In reply to Re: Net::IRC problem by erikharrison
in thread Net::IRC problem by Anonymous Monk

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.