+/* universal.c
+ *
+ * Copyright (c) 1997-2002, Larry Wall
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Artistic License, as specified in the README file.
+ *
+ */
+
+/*
+ * "The roots of those mountains must be roots indeed; there must be
+ * great secrets buried there which have not been discovered since the
+ * beginning." --Gandalf, relating Gollum's story
+ */
+
#include "EXTERN.h"
#define PERL_IN_UNIVERSAL_C
#include "perl.h"
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) {