X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=universal.c;h=caab476386528868540f42502341dc24dff8951d;hb=63315e187a785a8535d1f84110e060293f0f744c;hp=6b2214d24907a79ebd7f33de7064cb24108cfa8d;hpb=13f8f3987335c6eed94bd796ae4e7be8f788fdbf;p=p5sagit%2Fp5-mst-13.2.git diff --git a/universal.c b/universal.c index 6b2214d..caab476 100644 --- a/universal.c +++ b/universal.c @@ -14,6 +14,10 @@ * beginning." --Gandalf, relating Gollum's story */ +/* This file contains the code that implements the functions in Perl's + * UNIVERSAL package, such as UNIVERSAL->can(). + */ + #include "EXTERN.h" #define PERL_IN_UNIVERSAL_C #include "perl.h" @@ -374,7 +378,7 @@ XS(XS_UNIVERSAL_VERSION) vnumify(req),vnormal(req),vnumify(sv),vnormal(sv)); } - if ( sv_derived_from(sv, "version") ) { + if ( SvOK(sv) && sv_derived_from(sv, "version") ) { ST(0) = vnumify(sv); } else { ST(0) = sv;