When using Net::IRC 0.75 with current mozbot (a
perl-based IRC bot, see
http://www.mozilla.org/projects/mozbot/ for that
project), I get the messages below and the program quits.
When I add
no strict 'refs';
at line 69 - at the beginning sub args { } - then it
does work as expected.
(System is SuSE 9.1 with perl 5.8.3)
Looks like Event.pm is not really strict-refs-safe as
of now.
Here are the error messages:
------------------
Can't use string ("http://www.mozilla.org/projects/")
as an ARRAY ref while
"strict refs" in use at
/usr/lib/perl5/site_perl/5.8.3/Net/IRC/Event.pm line 73
(#1)
(F) Only hard references are allowed by "strict
refs". Symbolic
references are disallowed. See perlref.
Uncaught exception from user code:
Can't use string
("http://www.mozilla.org/projects/") as an ARRAY ref
while "strict refs" in use at
/usr/lib/perl5/site_perl/5.8.3/Net/IRC/Event.pm line 73.
Net::IRC::Event::args('Net::IRC::Event=HASH(0x8717f04)','http://www.mozilla.org/projects/mozbot/')
called at ./mozbot.pl line 817
main::on_topic('Net::IRC::Connection=HASH(0x8705b4c)','Net::IRC::Event=HASH(0x8717f04)')
called at
/usr/lib/perl5/site_perl/5.8.3/Net/IRC/Connection.pm
line 492
Net::IRC::Connection::handler() called at
/usr/lib/perl5/site_perl/5.8.3/Net/IRC/Connection.pm
line 1051
Net::IRC::Connection::parse('Net::IRC::Connection=HASH(0x8705b4c)','IO::Socket::INET=GLOB(0x8709cd0)')
called at /usr/lib/perl5/site_perl/5.8.3/Net/IRC.pm
line 178
Net::IRC::do_one_loop('Net::IRC=HASH(0x8627494)')
called at /usr/lib/perl5/site_perl/5.8.3/Net/IRC.pm
line 259
Net::IRC::start('Net::IRC=HASH(0x8627494)')
called at ./mozbot.pl line 3078
------------------
BTW, in your readme you misspelled the the URL of the
sourceforge project page, it should have "/projects/"
instead of "/project/" ;-)
Logged In: YES
user_id=414927
The bug here is that Event.pm's args() method changed semantics
between 0.74 and 0.75 -- it used to expect a list of arguments, now it
expects a reference to a list of arguments.
This is a non-backwards-compatible change, and is quite clearly buggy (if
you pass it 0 it would do nothing but if you pass it 1 it would crash, e.g.).
Fixing this would consist of changing this:
----------------------------------
sub args {
my $self = shift;
my $args = shift;
if($args) {
my (@q, $i, $ct) = @{$args}; # This line is solemnly dedicated to
\mjd.
----------------------------------
...to something like this:
----------------------------------
sub args {
my $self = shift;
my (@q, $i, $ct) = @_;
if(@q) {
----------------------------------