summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorJohn Peacock <jpeacock@rowman.com>2007-10-02 01:28:31 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-10-02 11:56:28 +0000
commitd1029faac9d1305e60db4bf8c9ec1552b40d4f64 (patch)
tree6c23eb57975ab4e3d36ed33353f43fe19106180a /pp_ctl.c
parentd91ed1da0761be78f6c84257e79636bc2a7a1b8f (diff)
downloadperl-d1029faac9d1305e60db4bf8c9ec1552b40d4f64.tar.gz
was Re: Freeze ?
Message-ID: <47020F3F.9070604@havurah-software.org> p4raw-id: //depot/perl@32003
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c41
1 files changed, 38 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 673e324dc2..f67326d0f1 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3105,9 +3105,44 @@ PP(pp_require)
SVfARG(vnormal(sv)), SVfARG(vnormal(PL_patchlevel)));
}
else {
- if ( vcmp(sv,PL_patchlevel) > 0 )
- DIE(aTHX_ "Perl %"SVf" required--this is only %"SVf", stopped",
- SVfARG(vnormal(sv)), SVfARG(vnormal(PL_patchlevel)));
+ if ( vcmp(sv,PL_patchlevel) > 0 ) {
+ I32 first = 0;
+ AV *lav;
+ SV * const req = SvRV(sv);
+ SV * const pv = *hv_fetchs((HV*)req, "original", FALSE);
+
+ /* get the left hand term */
+ lav = (AV *)SvRV(*hv_fetchs((HV*)req, "version", FALSE));
+
+ first = SvIV(*av_fetch(lav,0,0));
+ if ( first > (int)PERL_REVISION /* probably 'use 6.0' */
+ || hv_exists((HV*)req, "qv", 2 ) /* qv style */
+ || av_len(lav) > 1 /* FP with > 3 digits */
+ || strstr(SvPVX(pv),".0") /* FP with leading 0 */
+ ) {
+ DIE(aTHX_ "Perl %"SVf" required--this is only "
+ "%"SVf", stopped", SVfARG(vnormal(req)),
+ SVfARG(vnormal(PL_patchlevel)));
+ }
+ else { /* probably 'use 5.10' or 'use 5.8' */
+ SV * hintsv = newSV(0);
+ I32 second = 0;
+
+ if (av_len(lav)>=1)
+ second = SvIV(*av_fetch(lav,1,0));
+
+ second /= second >= 600 ? 100 : 10;
+ hintsv = Perl_newSVpvf(aTHX_ "v%d.%d.%d",
+ (int)first, (int)second,0);
+ upg_version(hintsv, TRUE);
+
+ DIE(aTHX_ "Perl %"SVf" required (did you mean %"SVf"?)"
+ "--this is only %"SVf", stopped",
+ SVfARG(vnormal(req)),
+ SVfARG(vnormal(hintsv)),
+ SVfARG(vnormal(PL_patchlevel)));
+ }
+ }
}
/* If we request a version >= 5.9.5, load feature.pm with the