This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
vxs.inc: arg list checking for UNIVERSAL::VERSION
authorFather Chrysostomos <sprout@cpan.org>
Wed, 11 Sep 2013 06:46:47 +0000 (23:46 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Sat, 4 Jan 2014 13:10:02 +0000 (05:10 -0800)
This brings it in line with the CPAN implementation.  It’s hard to
test this, as the tests should go in cpan/version, but the pure-Perl
implementation doesn’t check the number of arguments.

vxs.inc

diff --git a/vxs.inc b/vxs.inc
index 2aa93d1..646a532 100644 (file)
--- a/vxs.inc
+++ b/vxs.inc
@@ -62,6 +62,9 @@ XS(XS_UNIVERSAL_VERSION)
     const char *undef;
     PERL_UNUSED_ARG(cv);
 
+    if (items < 1)
+       Perl_croak(aTHX_ "Usage: UNIVERSAL::VERSION(sv, ...)");
+
     if (SvROK(ST(0))) {
         sv = MUTABLE_SV(SvRV(ST(0)));
         if (!SvOBJECT(sv))