diff options
| author | Ailin Nemui | 2015-02-02 14:02:20 +0100 |
|---|---|---|
| committer | Ailin Nemui | 2015-02-02 14:02:20 +0100 |
| commit | 0816da664099746d962ee06b7de71be7c570e069 (patch) | |
| tree | 8955895edd0432da036782d67aa253079b003ca8 | |
| parent | a457c0a97058fadf1b84247efd16176989412bc9 (diff) | |
| download | scripts.irssi.org-0816da664099746d962ee06b7de71be7c570e069.tar.bz2 | |
Localise the $/ special variable.
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.
| -rw-r--r-- | scripts/dau.pl | 2 | ||||
| -rw-r--r-- | scripts/dejunk.pl | 2 | ||||
| -rw-r--r-- | scripts/hlbot.pl | 1 | ||||
| -rw-r--r-- | scripts/ircgallery.pl | 2 | ||||
| -rw-r--r-- | scripts/news.pl | 2 | ||||
| -rw-r--r-- | scripts/xauth.pl | 4 |
6 files changed, 5 insertions, 8 deletions
diff --git a/scripts/dau.pl b/scripts/dau.pl index 6b959c0..89a6623 100644 --- a/scripts/dau.pl +++ b/scripts/dau.pl @@ -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 <>; diff --git a/scripts/dejunk.pl b/scripts/dejunk.pl index 5c7c01a..ce4d167 100644 --- a/scripts/dejunk.pl +++ b/scripts/dejunk.pl @@ -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; diff --git a/scripts/hlbot.pl b/scripts/hlbot.pl index d9e5113..1d8cfd6 100644 --- a/scripts/hlbot.pl +++ b/scripts/hlbot.pl @@ -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", ""); diff --git a/scripts/ircgallery.pl b/scripts/ircgallery.pl index c044a45..d700210 100644 --- a/scripts/ircgallery.pl +++ b/scripts/ircgallery.pl @@ -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); diff --git a/scripts/news.pl b/scripts/news.pl index c864404..b8d8609 100644 --- a/scripts/news.pl +++ b/scripts/news.pl @@ -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>'; diff --git a/scripts/xauth.pl b/scripts/xauth.pl index 430500d..c4b13c0 100644 --- a/scripts/xauth.pl +++ b/scripts/xauth.pl @@ -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) = |
