]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
Localise the $/ special variable.
authorAilin Nemui <redacted>
Mon, 2 Feb 2015 13:02:20 +0000 (14:02 +0100)
committerAilin Nemui <redacted>
Mon, 2 Feb 2015 13:02:20 +0000 (14:02 +0100)
Follow-up to #129 to fix all $/ inside the scripts archive. Also fix
dejunk to not break scripts using the assumed default. Note, other
scripts like cmpchans might still break your scripts due to the global
nature of the Perl.

scripts/dau.pl
scripts/dejunk.pl
scripts/hlbot.pl
scripts/ircgallery.pl
scripts/news.pl
scripts/xauth.pl

index 6b959c087573d71cb84fc69d3383f2d91ea8fe58..89a66230c20cc1940491b20b4dfcb1e3231ba60a 100644 (file)
@@ -2686,7 +2686,7 @@ sub switch_cool {
        } elsif ($style eq 'suffixes') {
                my $suffix;
                if (-e $file && -r $file) {
-                       $/ = "\n";
+                       local $/ = "\n";
                        @ARGV = ($file);
                        srand;
                        rand($.) < 1 && ($suffix = switch_parse_special($_, $channel)) while <>;
index 5c7c01a024d7c501f1d22eb9cfc28ccec48c3e25..ce4d167c853ea8a222e2199d3515670517723446 100644 (file)
@@ -274,7 +274,7 @@ sub load_activity_data {
         error("Could not read dejunk activity data from $fn: $!");
         return;
     }
-    $/ = undef;
+    local $/;
     my $file_contents = <$fh>;
     eval {
         my $data = eval $file_contents;
index d9e511342404437007bf36a8cbe716766b1ed76f..1d8cfd69b16cb4d84eede58ab467ca120dd26fc1 100644 (file)
@@ -209,7 +209,6 @@ my $proto = getprotobyname('udp');
 my $paddr = sockaddr_in($listen_port, $iaddr);
 socket(S, PF_INET, SOCK_DGRAM, $proto)   || die "socket: $!\n";
 bind(S, $paddr)                          || die "bind: $!\n";
-$| = 1;
 
 # Set input and signals etc. irssi related stuff.
 Irssi::input_add(fileno(S), INPUT_READ, "run_bot", "");
index c044a4554f3946bdd0b342ff692fc08d72440056..d7002101322edc5111d9e20d0fc0bda48b65c6c8 100644 (file)
@@ -50,7 +50,7 @@ sub print_gallery {
   my $next_channels = 0;
   my $channels;
 
-  $. = "\n";
+  local $/ = "\n";
   my $f = gensym;
   if (!open($f, "<", "$cache_path/$nick")) {
     Irssi::print("Couldn't open file $cache_path/$nick: $!", MSGLEVEL_CLIENTERROR);
index c864404f3f98818c030a83ab8711782d4e141e09..b8d86099a52553c3f3572b167c03205cabec6dcd 100644 (file)
@@ -46,8 +46,6 @@ my $news_window_name = 'news';
 my @colors = (15, 12, 03, 06, 05, 07, 14);
 my @articles = ();
 
-$| = 1;
-
 Irssi::command_bind article => sub {
        my $usage = '/article [-s <server>] [-p <port>] [-P <password> -U <login>] [-l <group> <count>] [-a] [-L <index>] <Message-ID>';
 
index 430500d4b1151e523450c2319e0871f18751b10b..c4b13c0c366c2197b88d0df8924e2c963112e17a 100644 (file)
@@ -362,7 +362,7 @@ sub read_users() {
         # and then we read the userfile.
         # apparently Irssi resets $/, so we set it here.
 
-        $/ = "\n";
+        local $/ = "\n";
         while( my $line = <XUSERS>) {
                 if( $line !~ /^(#|\s*$)/ ) { 
                         my ($nick, $ircnet, $password) = 
@@ -435,7 +435,7 @@ sub read_chans() {
         # and then we read the channelfile.
         # apparently Irssi resets $/, so we set it here.
 
-        $/ = "\n";
+        local $/ = "\n";
         while( my $line = <NICKCHANS>) {
                 if( $line !~ /^(#|\s*$)/ ) { 
                         my ($channel, $ircnet) = 
git clone https://git.99rst.org/PROJECT