Skip Menu |
 

This queue is for tickets about the ExtUtils-Constant CPAN distribution.

Report information
The Basics
Id: 29968
Status: resolved
Priority: 0/
Queue: ExtUtils-Constant

People
Owner: Nobody in particular
Requestors: MHX [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.16
Fixed in: (no value)

Attachments


Subject: SUBNAME or XS_SUBNAME ?
Download (untitled) / with headers
text/plain 663b
I wanted to change the name of the constant subroutine using the documented SUBNAME option. However, this didn't work, so I took a look at the code, and it seems that there's some confusion about SUBNAME and XS_SUBNAME. Using XS_SUBNAME works (and makes some sense in the context of C_SUBNAME), but that's hard to guess from the documentation. I'd suggest to fix the docs here, just in case anyone is already using this. The attached patch fixes the docs, renames the scalar holding XS_SUBNAME in XS_constant() for clarity, and fixes the code in WriteConstants() to default C_SUBNAME to XS_SUBNAME as documented. It also increments the version of EU::C. Marcus
Subject: ExtUtils-Constant-0.16.diff
diff -ruN ExtUtils-Constant-0.16/lib/ExtUtils/Constant.pm ExtUtils-Constant-0.16-mhx/lib/ExtUtils/Constant.pm --- ExtUtils-Constant-0.16/lib/ExtUtils/Constant.pm 2005-01-23 19:22:45.000000000 +0100 +++ ExtUtils-Constant-0.16-mhx/lib/ExtUtils/Constant.pm 2007-10-14 05:29:19.000000000 +0200 @@ -1,6 +1,6 @@ package ExtUtils::Constant; use vars qw (@ISA $VERSION @EXPORT_OK %EXPORT_TAGS); -$VERSION = 0.16; +$VERSION = 0.17; =head1 NAME @@ -149,7 +149,7 @@ breakout => $breakout}, @items); } -=item XS_constant PACKAGE, TYPES, SUBNAME, C_SUBNAME +=item XS_constant PACKAGE, TYPES, XS_SUBNAME, C_SUBNAME A function to generate the XS code to implement the perl subroutine I<PACKAGE>::constant used by I<PACKAGE>::AUTOLOAD to load constants. @@ -163,7 +163,7 @@ the number of parameters passed to the C function C<constant>] You can call the perl visible subroutine something other than C<constant> if -you give the parameter I<SUBNAME>. The C subroutine it calls defaults to +you give the parameter I<XS_SUBNAME>. The C subroutine it calls defaults to the name of the perl visible subroutine, unless you give the parameter I<C_SUBNAME>. @@ -172,10 +172,10 @@ sub XS_constant { my $package = shift; my $what = shift; - my $subname = shift; + my $XS_subname = shift; my $C_subname = shift; - $subname ||= 'constant'; - $C_subname ||= $subname; + $XS_subname ||= 'constant'; + $C_subname ||= $XS_subname; if (!ref $what) { # Convert line of the form IV,UV,NV to hash @@ -186,7 +186,7 @@ my $xs = <<"EOT"; void -$subname(sv) +$XS_subname(sv) PREINIT: #ifdef dXSTARG dXSTARG; /* Faster if we have it. */ @@ -445,7 +445,7 @@ The name of the file to write containing the XS code. The default is C<const-xs.inc>. -=item SUBNAME +=item XS_SUBNAME The perl visible name of the XS subroutine generated which will return the constants. The default is C<constant>. @@ -453,7 +453,7 @@ =item C_SUBNAME The name of the C subroutine generated which will return the constants. -The default is I<SUBNAME>. Child subroutines have C<_> and the name +The default is I<XS_SUBNAME>. Child subroutines have C<_> and the name length appended, so constants with 10 character names would be in C<constant_10> with the default I<XS_SUBNAME>. @@ -466,11 +466,11 @@ ( # defaults C_FILE => 'const-c.inc', XS_FILE => 'const-xs.inc', - SUBNAME => 'constant', + XS_SUBNAME => 'constant', DEFAULT_TYPE => 'IV', @_); - $ARGS{C_SUBNAME} ||= $ARGS{SUBNAME}; # No-one sane will have C_SUBNAME eq '0' + $ARGS{C_SUBNAME} ||= $ARGS{XS_SUBNAME}; # No-one sane will have C_SUBNAME eq '0' croak "Module name not specified" unless length $ARGS{NAME};
Thanks applied to blead as change 34044 (apart from the version bump, as blead is at 0.21 now)


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.