diff --git a/scripts/play.pl b/scripts/play.pl index ce42e7c..c440f8e 100644 --- a/scripts/play.pl +++ b/scripts/play.pl @@ -92,16 +92,19 @@ sub cmd_play { : weechat::config_integer($prio_s) ) or 10); - my $path = File::Find::Rule->file->name($file) + my $rule = File::Find::Rule->file->name($file) ->start(weechat::config_get_plugin('dir')); if ($find) { - weechat::print($buffer, " \t$_") while defined( $_ = $path->match ); + weechat::print($buffer, " \t$_") while defined( $_ = $rule->match ); return weechat::WEECHAT_RC_OK; } - if ($path = $path->match and open FH, "<", (($file !~ m"/") ? $path : - weechat::config_get_plugin('dir')."/$file")) { + my $path; + if ($file =~ m"/") { $path = weechat::config_get_plugin('dir')."/$file" } + else { $path = $rule->match } + + if ($path and open FH, "<", $path) { my @lines; push @lines, s/[\r\n]*$//r while ; close FH;