From: Nicholas Clark Date: Wed, 11 Jun 2008 22:07:33 +0000 (+0000) Subject: Patch from MHX to change the WriteConstant()'s documentation to note X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d4d22eb3733b563191a856e9572d0d8e44a71e67;p=p5sagit%2Fp5-mst-13.2.git Patch from MHX to change the WriteConstant()'s documentation to note that to change the constant subroutine's name one needs XS_SUBNAME not SUBNAME, and then make C_SUBNAME default to XS_SUBNAME to be consistent with the revised documentation. http://rt.cpan.org/Public/Bug/Display.html?id=29968 p4raw-id: //depot/perl@34044 --- diff --git a/lib/ExtUtils/Constant.pm b/lib/ExtUtils/Constant.pm index 91e9b1d..2bc6076 100644 --- a/lib/ExtUtils/Constant.pm +++ b/lib/ExtUtils/Constant.pm @@ -149,7 +149,7 @@ sub C_constant { 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::constant used by I::AUTOLOAD to load constants. @@ -163,7 +163,7 @@ be the same list of types as C was given. the number of parameters passed to the C function C] You can call the perl visible subroutine something other than C if -you give the parameter I. The C subroutine it calls defaults to +you give the parameter I. The C subroutine it calls defaults to the name of the perl visible subroutine, unless you give the parameter I. @@ -172,10 +172,10 @@ I. 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 @@ sub XS_constant { my $xs = <<"EOT"; void -$subname(sv) +$XS_subname(sv) PREINIT: #ifdef dXSTARG dXSTARG; /* Faster if we have it. */ @@ -465,7 +465,7 @@ for writing. The name of the file to write containing the XS code. The default is C. -=item SUBNAME +=item XS_SUBNAME The perl visible name of the XS subroutine generated which will return the constants. The default is C. @@ -473,7 +473,7 @@ constants. The default is C. =item C_SUBNAME The name of the C subroutine generated which will return the constants. -The default is I. Child subroutines have C<_> and the name +The default is I. Child subroutines have C<_> and the name length appended, so constants with 10 character names would be in C with the default I. @@ -486,11 +486,11 @@ sub WriteConstants { ( # 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};