Patched the code to solve two little bugs:
- corrected glob as it returns an array and not a single value
- corrected wrong filehandle name when closing file
-# RandName 1.0
+# RandName 1.1
#
# set a random real name taken from a file
#
use Irssi;
use vars qw($VERSION %IRSSI);
-$VERSION = '1.0';
+$VERSION = '1.1';
%IRSSI = (
authors => 'legion',
contact => 'a.lepore(at)email.it',
sub randname {
- my $namefile = glob Irssi::settings_get_str('random_realname_file');
+ my $namefile = (glob Irssi::settings_get_str('random_realname_file'))[0];
open (FILE, "<", $namefile) || return;
my $lines = 0; while(<FILE>) { $lines++; };
$realname = $_;
last;
}
- close(f);
+ close(FILE);
Irssi::print("%9RandName.pl%_:", MSGLEVEL_CRAP);
Irssi::command("set real_name $realname");