🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.readers
Article #243686

[slrn] cleanscore: Warnings with new perl

#243686
From: Ignatios Souvatzis
Date: Fri, 10 Dec 2010 14:23
65 lines
3221 bytes
I stumbled upon this after upgrading perl:

marie bin !% cleanscore.old
Prototype after '%' for main::insert_comment : %% at cleanscore.old line 30.
Prototype after '%' for main::end_of_score : %$ at cleanscore.old line 31.
Prototype after '%' for main::end_of_score : %$ at cleanscore.old line 326.
Prototype after '%' for main::insert_comment : %% at cleanscore.old line 358.

After some headaches leater, trying to understand perltut and perlsub and
the code in question, I came up with the appended patch (integrated in
pkgsrc since then, and sent to the author).

Apparently, the prototypes were added a bit hastily ... or whoever
added them, knew as much about them as I did yesterday morning.

En detail:

sub foo(%) eats all parameters and passes them as a list. Inside
the sub you get the parameters one by one with "shift", for example.

sub foo(\%\%) expects two hashes as parameters (but you'd have to
consume them that way inside the subroutine).

sub foo(%%) ... well... on a call, still all parameters are eaten
and processed into a list for the subroutine, and the 2nd %, or
the $ after the %, or whatever, used to be silently ignored for a 
couple of years, but nowadays it creates a warning. 

Regards,
	-is


$NetBSD: patch-aa,v 1.1 2010/12/09 14:59:37 is Exp $

--- cleanscore.orig	2010-12-09 12:33:33.000000000 +0000
+++ cleanscore
@@ -27,8 +27,8 @@ use Getopt::Std;
 
 sub help();
 sub reset_vars(%);
-sub insert_comment(%%);
-sub end_of_score(%$);
+sub insert_comment(%);
+sub end_of_score(%);
 sub clean_file($);
 
 # globals variables.
@@ -323,7 +323,7 @@ sub clean_file($)
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
-sub end_of_score(%$)
+sub end_of_score(%)
 {
   my $entry = shift;
   my $file_is_changed = shift;
@@ -355,7 +355,7 @@ sub end_of_score(%$)
 
 # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
 
-sub insert_comment(%%)
+sub insert_comment(%)
 {
   my $comment=shift;
   my $entry=shift;
Technical Details
Message-ID: <slrnig4dv5.bhi.u502sou@marie.beverly.kleinbus.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder4.news.weretis.net!news.wtal.de!news.tal.de!beverly.kleinbus.org!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <slrnig4dv5.bhi.u502sou@marie.beverly.kleinbus.org>
Subject: [slrn] cleanscore: Warnings with new perl
Date: Fri, 10 Dec 2010 15:23:33 +0100
From: Ignatios Souvatzis <u502sou@beverly.kleinbus.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!border1.nntp.ams3.giganews.com!border1.nntp.ams2.giganews.com!border2.nntp.ams2.giganews.com!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!nntp.giganews.com!weretis.net!feeder4.news.weretis.net!news.wtal.de!news.tal.de!beverly.kleinbus.org!not-for-mail
Newsgroups: news.software.readers
Organization: TAL.DE and customers
Lines: 65
NNTP-Posting-Host: beverly.kleinbus.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.wtal.de 1291991405 10092 213.240.180.139 (10 Dec 2010 14:30:05
 GMT)
X-Complaints-To: abuse@tal.de
NNTP-Posting-Date: 10 Dec 2010 14:30:05 GMT
User-Agent: slrn/0.9.9p1 (NetBSD)
X-Original-Bytes: 3033