From: Rafael Garcia-Suarez Date: Wed, 9 Jan 2008 10:11:10 +0000 (+0000) Subject: Remove the warning "v-string in require/use non portable" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e8342de65fb9cb7fd716c30bbddc9c0f4311ba0;p=p5sagit%2Fp5-mst-13.2.git Remove the warning "v-string in require/use non portable" p4raw-id: //depot/perl@32910 --- diff --git a/ext/B/B/Deparse.pm b/ext/B/B/Deparse.pm index 0472057..b0435ae 100644 --- a/ext/B/B/Deparse.pm +++ b/ext/B/B/Deparse.pm @@ -21,7 +21,7 @@ use B qw(class main_root main_start main_cv svref_2object opnumber perlstring PMf_KEEP PMf_GLOBAL PMf_CONTINUE PMf_EVAL PMf_ONCE PMf_MULTILINE PMf_SINGLELINE PMf_FOLD PMf_EXTENDED), ($] < 5.009 ? 'PMf_SKIPWHITE' : 'RXf_SKIPWHITE'); -$VERSION = 0.85; +$VERSION = 0.86; use strict; use vars qw/$AUTOLOAD/; use warnings (); @@ -1456,8 +1456,7 @@ sub declare_hints { my %ignored_hints = ( 'open<' => 1, 'open>' => 1, - 'v_string' => 1, - ); +); sub declare_hinthash { my ($from, $to, $indent) = @_; diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 1dd79a3..29d3cd6 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4935,18 +4935,6 @@ the version number. (W misc) The version string contains invalid characters at the end, which are being ignored. -=item v-string in use/require is non-portable - -(W portable) The use of v-strings is non-portable to older, pre-5.6, Perls. -If you want your scripts to be backward portable, use the floating -point version number: for example, instead of C say -C. This of course won't make older Perls suddenly start -understanding newer features, but at least they will show a sensible -error message indicating the required minimum version. - -This warning is suppressed if the C is preceded by a -C (see C in L). - =item Warning: something's wrong (W) You passed warn() an empty string (the equivalent of C) or diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index 49eb729..3456d9a 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -6873,22 +6873,16 @@ of perl older than the specified one. Specifying VERSION as a literal of the form v5.6.1 should generally be avoided, because it leads to misleading error messages under earlier -versions of Perl that do not support this syntax. The equivalent numeric -version should be used instead. - -Alternatively, you can use a numeric version C followed by a -v-string version like C, to avoid the unintuitive C. (older perl versions fail gracefully at the first C, -later perl versions understand the v-string syntax in the second). +versions of Perl (that is, prior to 5.6.0) that do not support this +syntax. The equivalent numeric version should be used instead. use v5.6.1; # compile time version check use 5.6.1; # ditto use 5.006_001; # ditto; preferred for backwards compatibility - use 5.006; use 5.6.1; # ditto, for compatibility and readability This is often useful if you need to check the current Perl version before -Cing library modules that have changed in incompatible ways from -older versions of Perl. (We try not to do this more than we have to.) +Cing library modules that won't work with older versions of Perl. +(We try not to do this more than we have to.) Also, if the specified perl version is greater than or equal to 5.9.5, C will also load the C pragma and enable all diff --git a/pp_ctl.c b/pp_ctl.c index 8998c1f..b1a4fd3 100644 --- a/pp_ctl.c +++ b/pp_ctl.c @@ -3084,14 +3084,6 @@ PP(pp_require) sv = POPs; if ( (SvNIOKp(sv) || SvVOK(sv)) && PL_op->op_type != OP_DOFILE) { - if ( SvVOK(sv) && ckWARN(WARN_PORTABLE) ) { /* require v5.6.1 */ - HV * hinthv = GvHV(PL_hintgv); - SV ** ptr = NULL; - if (hinthv) ptr = hv_fetchs(hinthv, "v_string", FALSE); - if ( !(ptr && *ptr && SvIOK(*ptr) && SvIV(*ptr)) ) - Perl_warner(aTHX_ packWARN(WARN_PORTABLE), - "v-string in use/require non-portable"); - } sv = new_version(sv); if (!sv_derived_from(PL_patchlevel, "version")) upg_version(PL_patchlevel, TRUE); @@ -3143,26 +3135,14 @@ PP(pp_require) /* We do this only with use, not require. */ if (PL_compcv && - /* If we request a version >= 5.6.0, then v-string are OK - so set $^H{v_string} to suppress the v-string warning */ - vcmp(sv, sv_2mortal(upg_version(newSVnv(5.006), FALSE))) >= 0) { - HV * hinthv = GvHV(PL_hintgv); - if( hinthv ) { - SV *hint = newSViv(1); - (void)hv_stores(hinthv, "v_string", hint); - /* This will call through to Perl_magic_sethint() which in turn - sets PL_hints correctly. */ - SvSETMAGIC(hint); - } /* If we request a version >= 5.9.5, load feature.pm with the * feature bundle that corresponds to the required version. */ - if (vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) { + vcmp(sv, sv_2mortal(upg_version(newSVnv(5.009005), FALSE))) >= 0) { SV *const importsv = vnormal(sv); *SvPVX_mutable(importsv) = ':'; ENTER; Perl_load_module(aTHX_ 0, newSVpvs("feature"), NULL, importsv, NULL); LEAVE; - } } RETPUSHYES; diff --git a/t/lib/warnings/pp_ctl b/t/lib/warnings/pp_ctl index 923d54c..afaf0a7 100644 --- a/t/lib/warnings/pp_ctl +++ b/t/lib/warnings/pp_ctl @@ -222,18 +222,6 @@ EXPECT Use of uninitialized value $foo in print at (eval 1) line 1. ######## # pp_ctl.c -use warnings 'portable'; -eval 'use 5.6.1'; -EXPECT -v-string in use/require non-portable at (eval 1) line 2. -######## -# pp_ctl.c -use warnings 'portable'; -eval 'use v5.6.1'; -EXPECT -v-string in use/require non-portable at (eval 1) line 2. -######## -# pp_ctl.c use warnings; { no warnings; @@ -245,15 +233,3 @@ EXPECT use warnings; eval 'use 5.006; use 5.10.0'; EXPECT -######## -# pp_ctl.c -use warnings; -eval '{use 5.006;} use 5.10.0'; -EXPECT -v-string in use/require non-portable at (eval 1) line 2. -######## -# pp_ctl.c -use warnings; -eval 'use vars; use 5.10.0'; -EXPECT -v-string in use/require non-portable at (eval 1) line 2.