develooper Front page | perl.perl5.porters | Postings from May 2008

bug? usage error in XS subs

Thread Next
From:
Nicholas Clark
Date:
May 21, 2008 04:03
Subject:
bug? usage error in XS subs
Message ID:
20080521110256.GG6742@plum.flirble.org
If you define a regular XS sub, and call it with the wrong number of
arguments, you get an error like this:

$ ./perl -Ilib -MPOSIX -we 'WEXITSTATUS(3,2,3)'
Usage: POSIX::WEXITSTATUS(status) at -e line 1.

You get the same error if you alias it:

$ ./perl -Ilib -MPOSIX -we '*pie = \&POSIX::WEXITSTATUS; pie(3,2,3)'
Usage: POSIX::WEXITSTATUS(status) at -e line 1.

If, however, your XS code uses the "ALIAS" function, your error message
changes, losing the package from the name:

$ ./perl -Ilib -MPOSIX -we 'WEXITSTATUS(3,2,3)'
Usage: WEXITSTATUS(status) at -e line 1.
$ ./perl -Ilib -MPOSIX -we '*pie = \&POSIX::WEXITSTATUS; pie(3,2,3)'
Usage: WEXITSTATUS(status) at -e line 1.

Is this a bug? Should we fix it so that the package name is there too?

I feel it's really only an implementation detail as to whether "ALIAS" was
used, and really not something that should poke through to Perl space.

Thoughts?
How much would break if this was changed within a maintenance branch?

(ie is anyone really parsing this error, who would also rebuild their code
with a newer ExtUtils::ParseXS, and put it into production without testing)

Nicholas Clark

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About