From: Eremita Solitario Date: Tue, 24 May 2022 19:54:06 +0000 (+0200) Subject: array returns from glob and wrong filehandle X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=b9891b132396831100d3244c92c24f34cf77b45a;p=irssi-scripts.irssi.org.git array returns from glob and wrong filehandle 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 --- diff --git a/scripts/randname.pl b/scripts/randname.pl index 388a78b..df5ae36 100644 --- a/scripts/randname.pl +++ b/scripts/randname.pl @@ -1,4 +1,4 @@ -# RandName 1.0 +# RandName 1.1 # # set a random real name taken from a file # @@ -8,7 +8,7 @@ use strict; use Irssi; use vars qw($VERSION %IRSSI); -$VERSION = '1.0'; +$VERSION = '1.1'; %IRSSI = ( authors => 'legion', contact => 'a.lepore(at)email.it', @@ -20,7 +20,7 @@ $VERSION = '1.0'; 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() { $lines++; }; @@ -34,7 +34,7 @@ sub randname { $realname = $_; last; } - close(f); + close(FILE); Irssi::print("%9RandName.pl%_:", MSGLEVEL_CRAP); Irssi::command("set real_name $realname");