From cfe266414f3e8904e82a5303767315c497dd135c Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sat, 23 Oct 2010 18:41:04 +0100 Subject: For PROXYSUBS, allow an explicit XS_SUBNAME of undef to suppress its generation. --- cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'cpan') diff --git a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm index 15c679f593..cb4ea5cb2f 100644 --- a/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm +++ b/cpan/ExtUtils-Constant/lib/ExtUtils/Constant/ProxySubs.pm @@ -163,8 +163,11 @@ sub WriteConstants { my $self = shift; my $ARGS = {@_}; - my ($c_fh, $xs_fh, $c_subname, $xs_subname, $default_type, $package) - = @{$ARGS}{qw(C_FH XS_FH C_SUBNAME XS_SUBNAME DEFAULT_TYPE NAME)}; + my ($c_fh, $xs_fh, $c_subname, $default_type, $package) + = @{$ARGS}{qw(C_FH XS_FH C_SUBNAME DEFAULT_TYPE NAME)}; + + my $xs_subname + = exists $ARGS->{XS_SUBNAME} ? $ARGS->{XS_SUBNAME} : 'constant'; my $options = $ARGS->{PROXYSUBS}; $options = {} unless ref $options; @@ -185,8 +188,6 @@ sub WriteConstants { carp ("PROXYSUBS options 'croak_on_error' requires v5.13.5 or later") if $croak_on_error && $^V < v5.13.5; - $xs_subname ||= 'constant'; - # If anyone is insane enough to suggest a package name containing % my $package_sprintf_safe = $package; $package_sprintf_safe =~ s/%/%%/g; @@ -557,6 +558,8 @@ EOBOOT EOBOOT } + return if !defined $xs_subname; + if ($croak_on_error || $autoload) { print $xs_fh $croak_on_error ? <<"EOC" : <<'EOA'; -- cgit v1.2.1