]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Fix perlcritic issues for all scripts starting with a
authorObfuscoder <redacted>
Fri, 17 Oct 2014 16:30:46 +0000 (18:30 +0200)
committerObfuscoder <redacted>
Fri, 24 Oct 2014 17:27:38 +0000 (19:27 +0200)
16 files changed:
scripts/act.pl
scripts/act_fifo.pl
scripts/ai.pl
scripts/aidle.pl
scripts/amarok_ssh.pl
scripts/apm.pl
scripts/armeija.pl
scripts/auto_whois.pl
scripts/autoaway.pl
scripts/autolimit.pl
scripts/autoopper.pl
scripts/autowhois.pl
scripts/autowhois_simple.pl
scripts/away.pl
scripts/away2web.pl
scripts/awayproxy.pl

index 0b20de825dc59d8d62415326596d7a43775f3677..b14435fecb611941489d1cc2d93bd0754229cf5c 100644 (file)
@@ -4,6 +4,7 @@
 #    - http://www.penguin-breeder.org/irssi/
 
 #<scriptinfo>
+use strict;
 use vars qw($VERSION %IRSSI);
 
 use Irssi 20020120;
@@ -32,6 +33,8 @@ $VERSION = "0.13";
 sub cmd_act {
     my ($data, $server, $channel) = @_;
 
+    my $level;
+
     if ($data eq "") {
       $level = 1;
     } elsif ($data =~ /^public$/i) {
@@ -55,7 +58,7 @@ sub cmd_act {
 }
 
 my @arguments = ('public', 'all');
-sub sig_complete ($$$$$) {
+sub sig_complete {
     my ($list, $window, $word, $linestart, $want_space) = @_;
     return unless $linestart =~ /^.act/;
     foreach my $arg (@arguments) {
index 11ec318a72938256bc6cafd8541af300c9b538b2..c0c55d01e6c3c9e1dc5d4c0baacfe52e71ab9e53 100644 (file)
@@ -17,6 +17,7 @@
 #     1.1:  Now also updates fifo when config or window numbers are changed.
 # 
 
+use strict;
 use Irssi qw(
        settings_get_int settings_get_str
        settings_add_int settings_add_str
@@ -153,7 +154,7 @@ unless (-p $path)
        else
        {
                require POSIX;
-               POSIX::mkfifo($path, 0666) or die "can\'t mkfifo $path: $!";
+               POSIX::mkfifo($path, oct(666)) or die "can\'t mkfifo $path: $!";
                Irssi::print("Fifo created. Start reading it (\"cat $path\") and try again.");
                return;
        }
index d6dfd45cdfeba890b52b37ed7b0f75d5615602a8..af3e5c170f3637a4e6037163ae0620f1f319c3a4 100644 (file)
@@ -1,6 +1,6 @@
+use strict;
 use Irssi;
 use Irssi::Irc;
-use strict;
 
 use vars qw($VERSION %IRSSI);
 
@@ -141,7 +141,7 @@ sub combineSettings {
        return 0;
 }
 
-sub sig_action() {
+sub sig_action {
        my ($server,$msg,$nick,$address,$target) = @_;
        
        my $command;
index ddf92d1f774dfbb7a8481095cc700d2aaebcdf03..93c30ee18fd389fd3963c3d1dbb094e359f6d16e 100644 (file)
@@ -1,3 +1,4 @@
+use strict;
 use Irssi 20020300;
 use Irssi::Irc;
 
@@ -52,15 +53,15 @@ sub antyidlesend {
 
 Irssi::signal_add 'setup changed' => sub {
        $aidle{'away'} = Irssi::settings_get_bool 'aidle_only_when_away';
-       my $new = Irssi::settings_get_int 'aidle_max_idle_time';
-       if ($new < $aidle{'max'}) {
+       my $max_idle_time = Irssi::settings_get_int 'aidle_max_idle_time';
+       if ($max_idle_time < $aidle{'max'}) {
                Irssi::timeout_remove $aidle{'timer'};
-               $aidle{'timer'} = Irssi::timeout_add int(rand($new)+1) * 1000, 'antyidlesend', '';
+               $aidle{'timer'} = Irssi::timeout_add int(rand($max_idle_time)+1) * 1000, 'antyidlesend', '';
        }
-       $aidle{'max'} = $new;
+       $aidle{'max'} = $max_idle_time;
        @{$aidle{'ircnets'}} = (split(/[\s,|-]+/, Irssi::settings_get_str('aidle_ircnets')));
-       foreach $new (@{$aidle{'ircnets'}}) {
-               Irssi::print("%RWarning%n - no such chatnet \'$new\' !", MSGLEVEL_CLIENTERROR) unless (Irssi::chatnet_find($new));
+       foreach my $ircnet (@{$aidle{'ircnets'}}) {
+               Irssi::print("%RWarning%n - no such chatnet \'$ircnet\' !", MSGLEVEL_CLIENTERROR) unless (Irssi::chatnet_find($ircnet));
        }
 }; 
 
index 091c3182da4c0e70935762765750456dd80c0d91..22206c357d7e315cc25ff7a16c4b72578fa63f37 100644 (file)
@@ -19,7 +19,7 @@ Irssi::settings_add_bool('amarok', 'amarok_use_ssh', 1);
 Irssi::settings_add_str('amarok', 'amarok_ssh_client', 'localhost');
 Irssi::settings_add_str('amarok', 'amarok_dcop_user', '');
 
-sub show_help() {
+sub show_help {
     my $help = $IRSSI{name}." ".$VERSION."
 /amarok song [loud]
     Prints the artist and title of the song which is currently played.
@@ -65,7 +65,7 @@ my $amarok_use_ssh = Irssi::settings_get_bool('amarok_use_ssh');
 my $ssh_client = Irssi::settings_get_str('amarok_ssh_client');
 my $dcop_user = Irssi::settings_get_str('amarok_dcop_user');
 
-sub cmd ($) {
+sub cmd {
     my ($postcmd) = @_;
     my $dcop_precmd = 'dcop --user '.$dcop_user.' amarok player';
 
@@ -78,7 +78,7 @@ sub cmd ($) {
     }
 }
 
-sub amarokSong ($$) {
+sub amarokSong {
     my($witem, $me_cmd) = @_;
     if ($me_cmd == 1) {
         if (!$witem or $witem->{type} ne 'CHANNEL') {
@@ -99,7 +99,7 @@ sub amarokSong ($$) {
     }
 }
 
-sub amarokTime($$) {
+sub amarokTime {
     my ($witem, $me_cmd) = @_;
     if ($me_cmd == 1 and (!$witem or $witem->{type} ne 'CHANNEL')) {
         print CLIENTCRAP $preprint."The option 'loud' can only be used in channels.";
@@ -142,7 +142,7 @@ sub amarokTime($$) {
     }
 }
 
-sub amarokSeek ($) {
+sub amarokSeek {
     my($time) = @_;
     
     # format correct?
@@ -194,7 +194,7 @@ sub amarokSeek ($) {
     print CLIENTCRAP $preprint.'Seeked to '.$newtime.'.';
 }
 
-sub cmd_amarok ($$$) {
+sub cmd_amarok {
     my ($args, $server, $witem) = @_;
     my @arg = split(/ /, $args);
     
index 1cf5a2489df0fa42d8df9830a0ee262e647b567c..ec42c669218a5ee0c3ae790cfeb57d577bbd1c2d 100644 (file)
@@ -47,7 +47,7 @@ exit unless ($apm or $acpi);
 
 
 sub get_apm {
-       open(RC, "/proc/apm");
+       open(RC, q{<}, "/proc/apm");
                my $line = <RC>;
        close RC;
        my ($ver1, $ver2, $sysstatus, $acstat, $chargstat, $batstatus, $prozent, $remain) = split(/\s/,$line);
@@ -56,13 +56,13 @@ sub get_apm {
 }
 
 sub get_acpi {
-       open(RC, "/proc/acpi/ac_adapter/ACAD/state");
+       open(RC, q{<}, "/proc/acpi/ac_adapter/ACAD/state");
                my $line = <RC>;
        close RC;
        my ($text,$state) = split (/:/,$line);
        $state =~ s/\s//g;
 
-       open (RC, "/proc/acpi/battery/BAT0/info");
+       open (RC, q{<}, "/proc/acpi/battery/BAT0/info");
        my ($text,$capa,$ein);
        while (my $line = <RC>) {
                if ($line =~ /last full capacity/) {
@@ -70,7 +70,7 @@ sub get_acpi {
                        $capa =~ s/\s//g;
                }
        }
-       open (RC, "/proc/acpi/battery/BAT0/state"); 
+       open (RC, q{<}, "/proc/acpi/battery/BAT0/state"); 
        my ($text,$remain,$ein);
        while (my $line = <RC>) {
                if ($line =~ /remaining capacity/) {
@@ -95,7 +95,7 @@ sub power {
                $pstate = get_acpi();
        }
        $item->default_handler($get_size_only, undef, "BAT:$pstate", 1 );
-       }
+}
 
 
 sub set_power {
index 5312bd621e5b1d38d6d90c36596a458f42cf7b42..fc854c6b2d6217f3863ffe28fa54c360d4c47451 100644 (file)
@@ -7,6 +7,7 @@
 
 # check out my other irssi-stuff at http://xulfad.inside.org/~flux/software/irssi/
 
+use strict;
 use Irssi;
 
 use vars qw($VERSION %IRSSI);
@@ -23,7 +24,6 @@ $VERSION = "0.4";
 
 
 use Irssi::Irc;
-use strict;
 
 my $log = 0;
 my $logFile = "$ENV{HOME}/.irssi/armeija.log";
@@ -104,7 +104,7 @@ sub public {
     $why = $msg;
     $who = $nick;
     if ($log) {
-      open(F, ">>$logFile");
+      open(F, q{>>}, $logFile);
       my @t = localtime($now);
       $t[5] += 1900;
       print F "$t[5]-", p0($t[4] + 1), "-", p0($t[3]), " ",
@@ -163,7 +163,7 @@ sub logging {
 sub load {
   local $/ = "\n";
   local *F;
-  if (open(F, "< $wordFile")) {
+  if (open(F, q{<}, $wordFile)) {
     @keywords = ();
     while (<F>) {
       chomp;
@@ -173,7 +173,7 @@ sub load {
   } else {
     Irssi::print("Failed to open wordfile $wordFile\n");
   }
-  if (open(F, "< $channelFile")) {
+  if (open(F, q{<}, $channelFile)) {
     @channels = ();
     while (<F>) {
       chomp;
@@ -185,13 +185,13 @@ sub load {
 
 sub save {
   local *F;
-  if (open(F, "> $wordFile")) {
+  if (open(F, q{>}, $wordFile)) {
     for (my $c = 0; $c < @keywords; ++$c) {
       print F $keywords[$c], "\n";
     }
     close(F);
   }
-  if (open(F, "> $channelFile")) {
+  if (open(F, q{>}, $channelFile)) {
     for (my $c = 0; $c < @channels; ++$c) {
       print F $channels[$c], "\n";
     }
index 0f4fe294f1a777033504800f72c27ba44b5b3e39..59fc1ef375d290b84ca7e6868b870ffbf15d3bd9 100644 (file)
@@ -1,6 +1,7 @@
 # /WHOIS all the users who send you a private message.
 # v0.9 for irssi by Andreas 'ads' Scherbaum
 # idea and some code taken from autowhois.pl from Timo Sirainen
+use strict;
 use Irssi;
 use vars qw($VERSION %IRSSI); 
 
index 26fc3b0ca61d1c9d7cf1c4e2dddba596ab1a6bca..be6cbf7b73f22e2f86846a564187c3c828c241a9 100644 (file)
@@ -18,6 +18,7 @@
 
 # Thanks to Adam Monsen for multiserver and config file fix
 
+use strict;
 use Irssi;
 use Irssi::Irc;
 
@@ -130,7 +131,7 @@ sub reset_timer {
 
 Irssi::settings_add_int("misc", "autoaway_timeout", 0);
 
-$autoaway_default = Irssi::settings_get_int("autoaway_timeout");
+my $autoaway_default = Irssi::settings_get_int("autoaway_timeout");
 if ($autoaway_default) {
   $autoaway_to_tag =
     Irssi::timeout_add($autoaway_default*1000, "auto_timeout", "");
index 3864bd1bcb3f4f3d3121621215e502d975238969..7d25427a3b50e17745ecfea81b4f08657e60741a 100644 (file)
@@ -1,4 +1,6 @@
+use strict;
 use Irssi 20010920.0000 ();
+use vars qw($VERSION %IRSSI);
 $VERSION = "1.00";
 %IRSSI = (
     authors     => 'David Leadbeater',
index 061e5bc5f7ba745bbc3fd5d4d021d2fded54451f..61882f3fffcfe55caa302ff7527f6b606075bc69 100644 (file)
@@ -1,6 +1,6 @@
+use strict;
 use Irssi;
 use POSIX;
-use strict;
 use Socket;
 use vars qw($VERSION %IRSSI);
 
index 1f9802ecd45524d60eaa7ec14277462a344a7197..5ec6c199b5ca93477754143a979afc111a4478fb 100644 (file)
@@ -1,5 +1,6 @@
 # /WHOIS all the users who send you a private message.
 # v1.1 for irssi 0.7.98 by Timo Sirainen
+use strict;
 use Irssi;
 use vars qw($VERSION %IRSSI); 
 $VERSION = "1.1";
@@ -17,7 +18,7 @@ $VERSION = "1.1";
 # History:
 #  v1.1: don't /WHOIS if query exists for the nick already
 
-my $lastfrom, $lastquery;
+my ($lastfrom, $lastquery);
 
 sub msg_private_first {
   my ($server, $msg, $nick, $address) = @_;
index 74ae039abc578a1fd5676c21dac8f9ec6bcd23d8..154f9b068da7cef159c4f5576a272163577e8fef 100644 (file)
@@ -3,13 +3,14 @@
 # only when the query window has been created 
 # and therefore works only with irssi with
 # default query window behaviour.
+use strict;
 use Irssi;
 use vars qw($VERSION %IRSSI); 
 
 $VERSION = "0.1";
 %IRSSI = (
     authors=> "Janne Mikola",
-    contact=> "janne@mikola.info",
+    contact=> "janne\@mikola.info",
     name=> "autowhois_simple",
     description=> "/WHOIS anyone querying you automatically.",
     license=> "GPL",
@@ -18,8 +19,7 @@ $VERSION = "0.1";
     changes=> "v0.1: Initial release"
 );
 
-# Global
-$handle_this_query = 0;
+my $handle_this_query = 0;
 
 # Checks the birth of a new query window.
 sub new_query {
index 827aedd224d1961596e74e2e12a8da79055618b7..9018903dd43b1c69700002994610a4d5670d47cc 100644 (file)
@@ -1,6 +1,8 @@
 # $Id: away.pl,v 1.6 2003/02/25 08:48:56 nemesis Exp $
 
+use strict;
 use Irssi 20020121.2020 ();
+use vars qw($VERSION %IRSSI);
 $VERSION = "0.23";
 %IRSSI = (
          authors     => 'Jean-Yves Lefort, Larry "Vizzie" Daffner, Kees Cook',
@@ -65,7 +67,6 @@ $VERSION = "0.23";
 # BUGS:
 #  - This only works for the first server
 
-use strict;
 use Irssi;
 use Irssi::Irc;                        # for DCC object
 
index 3077b9b2bfc801ebf60caa390da7f2e80ffba3b5..7414c23150b1402b18fc149be5d2e12d03d44322 100644 (file)
@@ -35,7 +35,7 @@ use Irssi 20020324;
 sub catch_away {
        my $server = shift;
 
-       open(STATUSFILE, '> '.$ENV{'HOME'}.'/.irssi/away2web-status') || die ("away2web.pl: Could not open file for writing:".$!);
+       open(STATUSFILE, q{>}, $ENV{'HOME'}.'/.irssi/away2web-status') || die ("away2web.pl: Could not open file for writing:".$!);
 
        if ($server->{usermode_away}) {
            # User is offline.
index 422a6ad6599249be6eb8bf0718a85b2ac40de6ad..628e0f45834ae14b12c31f434559927899102345 100644 (file)
@@ -147,7 +147,7 @@ sub msgsend_check { # {{{
 sub send_mail { # {{{
        my $text = shift;
        debug("Sending mail");
-       open MAIL, "|" . $config{sendmail} . " -t";
+       open MAIL, q{|-}, $config{sendmail} . " -t";
        print MAIL "To: $config{emailto}\n";
        print MAIL "From: $config{emailfrom}\n";
        print MAIL "Subject: $config{emailsubject}\n";
git clone https://git.99rst.org/PROJECT