1
0
mirror of https://github.com/irssi/irssi.git synced 2025-01-03 14:56:47 -05:00

fix deprecated perl warnings in scriptassist by removing all occurences of "defined"

This commit is contained in:
Ailin Nemui 2014-06-11 13:54:01 +02:00
parent a6507f827b
commit c5ad61b4b0

View File

@ -94,7 +94,7 @@ sub call_openurl ($) {
my ($url) = @_; my ($url) = @_;
no strict "refs"; no strict "refs";
# check for a loaded openurl # check for a loaded openurl
if (defined %{ "Irssi::Script::openurl::" }) { if ( %{ "Irssi::Script::openurl::" }) {
&{ "Irssi::Script::openurl::launch_url" }($url); &{ "Irssi::Script::openurl::launch_url" }($url);
} else { } else {
print CLIENTCRAP "%R>>%n Please install openurl.pl"; print CLIENTCRAP "%R>>%n Please install openurl.pl";
@ -204,7 +204,7 @@ sub script_info ($) {
my %result; my %result;
my $xml = get_scripts(); my $xml = get_scripts();
foreach (@{$scripts}) { foreach (@{$scripts}) {
next unless (defined $xml->{$_.".pl"} || (defined %{ 'Irssi::Script::'.$_.'::' } && defined %{ 'Irssi::Script::'.$_.'::IRSSI' })); next unless (defined $xml->{$_.".pl"} || ( %{ 'Irssi::Script::'.$_.'::' } && %{ 'Irssi::Script::'.$_.'::IRSSI' }));
$result{$_}{version} = get_remote_version($_, $xml); $result{$_}{version} = get_remote_version($_, $xml);
my @headers = ('authors', 'contact', 'description', 'license', 'source'); my @headers = ('authors', 'contact', 'description', 'license', 'source');
foreach my $entry (@headers) { foreach my $entry (@headers) {
@ -686,8 +686,8 @@ sub list_sbitems ($) {
my $text; my $text;
foreach (@$scripts) { foreach (@$scripts) {
no strict 'refs'; no strict 'refs';
next unless defined %{ "Irssi::Script::${_}::" }; next unless %{ "Irssi::Script::${_}::" };
next unless defined %{ "Irssi::Script::${_}::IRSSI" }; next unless %{ "Irssi::Script::${_}::IRSSI" };
my %header = %{ "Irssi::Script::${_}::IRSSI" }; my %header = %{ "Irssi::Script::${_}::IRSSI" };
next unless $header{sbitems}; next unless $header{sbitems};
$text .= '%9"'.$_.'"%9 provides the following statusbar item(s):'."\n"; $text .= '%9"'.$_.'"%9 provides the following statusbar item(s):'."\n";
@ -774,7 +774,7 @@ sub print_update (%) {
sub contact_author ($) { sub contact_author ($) {
my ($script) = @_; my ($script) = @_;
no strict 'refs'; no strict 'refs';
return unless defined %{ "Irssi::Script::${script}::" }; return unless %{ "Irssi::Script::${script}::" };
my %header = %{ "Irssi::Script::${script}::IRSSI" }; my %header = %{ "Irssi::Script::${script}::IRSSI" };
if (defined $header{contact}) { if (defined $header{contact}) {
my @ads = split(/ |,/, $header{contact}); my @ads = split(/ |,/, $header{contact});
@ -854,7 +854,7 @@ sub get_remote_version ($$) {
sub get_local_version ($) { sub get_local_version ($) {
my ($script) = @_; my ($script) = @_;
no strict 'refs'; no strict 'refs';
return unless defined %{ "Irssi::Script::${script}::" }; return unless %{ "Irssi::Script::${script}::" };
my $version = ${ "Irssi::Script::${script}::VERSION" }; my $version = ${ "Irssi::Script::${script}::VERSION" };
return $version; return $version;
} }
@ -1087,8 +1087,8 @@ sub sig_command_script_load ($$$) {
my ($script, $server, $witem) = @_; my ($script, $server, $witem) = @_;
no strict; no strict;
$script = $2 if $script =~ /(.*\/)?(.*?)\.pl$/; $script = $2 if $script =~ /(.*\/)?(.*?)\.pl$/;
if (defined %{ "Irssi::Script::${script}::" }) { if ( %{ "Irssi::Script::${script}::" }) {
if (defined &{ "Irssi::Script::${script}::pre_unload" }) { if ( &{ "Irssi::Script::${script}::pre_unload" }) {
print CLIENTCRAP "%R>>%n Triggering pre_unload function of $script..."; print CLIENTCRAP "%R>>%n Triggering pre_unload function of $script...";
&{ "Irssi::Script::${script}::pre_unload" }(); &{ "Irssi::Script::${script}::pre_unload" }();
} }