Subject: | name method returns wrong |
Bot::BasicBot 0.7 name method always returns the nick concat " bot"
even if name is explicitely set due to a bug in object handling. See
attached patch and testcase.
Subject: | name.diff |
--- /usr/lib/perl5/site_perl/5.8.8/Bot/BasicBot.pm
+++ Bot/BasicBot.pm
@@ -801,7 +801,7 @@
sub name {
my $self = shift;
$self->{name} = shift if @_;
- $_[0]->{name} or $self->nick . " bot";
+ $self->{name} or $self->nick . " bot";
}
=head2 channels
Subject: | name.t |
#!/usr/bin/perl
use strict;
use warnings;
package Buggy;
use base qw(Bot::BasicBot);
package main;
use Test::Simple tests => 2;
my $n = 'The Bugged Bot';
{
my $b = Buggy->new(
server => 'irc.perl.org',
channels => ['#doesnotmatter'],
nick => 'bugbot',
name => $n,
);
ok $b->name eq $n, 'name in constructor';
};
{
my $b = Buggy->new(
server => 'irc.perl.org',
channels => ['#doesnotmatter'],
nick => 'bugbot',
);
$b->name($n);
ok $b->name eq $n, 'name as method';
};