diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-21 18:31:42 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-21 18:31:42 +0000 |
commit | 4628e4f8c013135d9c9ab7023d7730ab67289444 (patch) | |
tree | ad9e7adff33e4c82f45719e2dc79976e3f967a68 /lib/ExtUtils | |
parent | b22c7a20398f928f9697b491d180b979ff211bd6 (diff) | |
download | perl-4628e4f8c013135d9c9ab7023d7730ab67289444.tar.gz |
allow optional XSUB parameters without being forced to use a
default (from Hugo van der Sanden)
p4raw-id: //depot/perl@5183
Diffstat (limited to 'lib/ExtUtils')
-rwxr-xr-x | lib/ExtUtils/xsubpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ExtUtils/xsubpp b/lib/ExtUtils/xsubpp index 431d75ad84..4ff0d3834c 100755 --- a/lib/ExtUtils/xsubpp +++ b/lib/ExtUtils/xsubpp @@ -1576,7 +1576,11 @@ sub generate_init { eval qq/print "\\t$var;\\n"/; warn $@ if $@; } - $deferred .= eval qq/"\\n\\tif (items < $num)\\n\\t $var = $defaults{$var};\\n\\telse {\\n$expr;\\n\\t}\\n"/; + if ($defaults{$var} eq 'undef') { + $deferred .= eval qq/"\\n\\tif (items >= $num) {\\n$expr;\\n\\t}\\n"/; + } else { + $deferred .= eval qq/"\\n\\tif (items < $num)\\n\\t $var = $defaults{$var};\\n\\telse {\\n$expr;\\n\\t}\\n"/; + } warn $@ if $@; } elsif ($ScopeThisXSUB or $expr !~ /^\t\$var =/) { if ($name_printed) { |