Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[slrn] cleanscore: Warnings with new perl

49 views
Skip to first unread message

Ignatios Souvatzis

unread,
Dec 10, 2010, 9:23:33 AM12/10/10
to
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;

Adam Funk

unread,
Dec 13, 2010, 2:26:59 PM12/13/10
to
On 2010-12-10, Ignatios Souvatzis wrote:

> 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.

What version of perl? (I'm now using 5.10.1 & I've never seen those
errors.)

--
History teaches that grave threats to liberty often come in times of
urgency, when constitutional rights seem too extravagant to endure.
(Thurgood Marshall)

Ignatios Souvatzis

unread,
Dec 14, 2010, 9:40:41 AM12/14/10
to
Adam Funk wrote:
> On 2010-12-10, Ignatios Souvatzis wrote:
>
>> 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.
>
> What version of perl? (I'm now using 5.10.1 & I've never seen those
> errors.)

|% perl -v | fmt | head -5
|This is perl 5, version 12, subversion 2 (v5.12.2) built for
|arm-netbsd-thread-multi
|
|Copyright 1987-2010, Larry Wall
|

Regards,
-is
--
seal your e-mail: http://www.gnupg.org/

Adam Funk

unread,
Dec 16, 2010, 7:16:25 AM12/16/10
to


Ah, something to look forward to.


--
Unix is a user-friendly operating system. It's just very choosy about
its friends.

0 new messages