diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-11-22 22:34:07 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-11-23 06:04:43 -0800 |
commit | c2a3bbbf95242da21477313087361902cd3b026e (patch) | |
tree | 2afc45eac8b6375dc5ad07e05627600b8b0f1444 /universal.c | |
parent | 47a0660e68fc38d8d2ff11855d0d5fa5e2af0b82 (diff) | |
download | perl-c2a3bbbf95242da21477313087361902cd3b026e.tar.gz |
UNIVERSAL::VERSION should treat "version" as a string
It was treating it as a version object and then failing the validation
test, instead of treating it as an invalid version format, as it does
with "versions":
$ ./perl -Ilib -e'$VERSION = "versions"; main->VERSION(1)'
Invalid version format (dotted-decimal versions require at least three parts) at -e line 1.
$ ./perl -Ilib -e'$VERSION = "version"; main->VERSION(1)'
Invalid version object at -e line 1.
See also perl #102586.
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/universal.c b/universal.c index b62a92370b..57650e8f68 100644 --- a/universal.c +++ b/universal.c @@ -449,10 +449,10 @@ XS(XS_UNIVERSAL_VERSION) } } - if ( !sv_derived_from(sv, "version")) + if ( !sv_derived_from(sv, "version") || !SvROK(sv)) upg_version(sv, FALSE); - if ( !sv_derived_from(req, "version")) { + if ( !sv_derived_from(req, "version") || !SvROK(req)) { /* req may very well be R/O, so create a new object */ req = sv_2mortal( new_version(req) ); } |