I'm trying to do some experiment with Net::IRC, but I have major problems. First of all, look at the beginning of the program I wrote:
#!/urs/bin/perl use strict; use Net::IRC; use LWP::Simple; use HTML::Parser; use Data::Dumper; my $bot = new Net::IRC; my $connection = $bot->newconn(Nick => 'HAL', Server => 'irc.tin.it', Port => '6667', Ircname => 'some name...', UserName => 'HAL' ) || die "Can't connect - $!\n"; # Add handlers here... $bot->start;
...omissis...

It's very similar to the beginning of irctest, the script that is provided with Net::IRC package. Despite of this fact, it does not work. irctest neither. They both give to me an error message:

Can't connect to irc.tin.it:6667! at /usr/lib/perl5/site_perl/5.6.0/Net/IRC.pm line 192
Can't connect - Bad file descriptor

So I tried to look into the code of the module. Line 192 of IRC.pm is the line that requests a new instance of Connection:

my $conn = Net::IRC::Connection->new($self, @_);

So I looked closer in the code... Here the code that fails (from Connection.pm):

if (connect( $sock, sockaddr_in($self->port, inet_aton($self->server)) + )) { $self->socket($sock); } else { carp (sprintf "Can't connect to %s:%s!", $self->server, $self->por +t); $self->error(1); return; }
$self->port and $self->server are well defined, and $sock is created with the socket function, so it seems to me the problem is not in my code. Since I'm convinced that Net::IRC would work (I didn't have problem when I installed it from CPAN), I ask you if it may depend on my system configuration (I use RedHat Linux and Perl 5.6.0) and how could I solve the problem.

In reply to Net::IRC does not connect by larsen

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.