From: Paul Marquess Date: Fri, 1 Mar 2002 23:47:48 +0000 (+0000) Subject: RE: VERSION core X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=62658f4d9934aba5f8b23afcc078dc12b3a40223;p=p5sagit%2Fp5-mst-13.2.git RE: VERSION core From: "Paul Marquess" Message-ID: p4raw-id: //depot/perl@14937 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 9db2807..9d6e07b 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -1223,6 +1223,11 @@ array is empty, just use C for example. checks for an undefined I value. If you want to see if the hash is empty, just use C for example. +=item %s defines neither package nor VERSION--version check failed + +(F) You said something like "use Module 42" but in the Module file +there are neither package declarations nor a C<$VERSION>. + =item Delimiter for here document is too long (F) In a here document construct like C<<, the label C is too @@ -1266,6 +1271,11 @@ you called it with no args and both C<$@> and C<$_> were empty. See Server error. +=item %s does not define %s::VERSION--version check failed + +(F) You said something like "use Module 42" but the Module did not +define a C<$VERSION.> + =item Don't know how to handle magic of type '%s' (P) The internal handling of magical variables has been cursed. diff --git a/universal.c b/universal.c index 8fe67b9..d629dfd 100644 --- a/universal.c +++ b/universal.c @@ -290,10 +290,18 @@ XS(XS_UNIVERSAL_VERSION) STRLEN len; SV *req = ST(1); - if (undef) - Perl_croak(aTHX_ "%s does not define $%s::VERSION--version check failed", - HvNAME(pkg), HvNAME(pkg)); - + if (undef) { + if (pkg) + Perl_croak(aTHX_ + "%s does not define $%s::VERSION--version check failed", + HvNAME(pkg), HvNAME(pkg)); + else { + char *str = SvPVx(ST(0), len); + + Perl_croak(aTHX_ + "%s defines neither package nor VERSION--version check failed", str); + } + } if (!SvNIOK(sv) && SvPOK(sv)) { char *str = SvPVx(sv,len); while (len) {