List Info

Thread: use 5.010 is ugly; use 5.10.0 warns




use 5.010 is ugly; use 5.10.0 warns
user name
2007-09-18 06:49:10

I don't like the warning from C<use 5.10.0> and I don't like C<use 5010> - it doesn't say what I mean.

I some of my modules I have used C<use 5.006; use 5.8.x;>
as a portable way of way of C<use 5.8.x> without writing C<use 5.00800x;&gt;

I have a patch which prevents C<use 5.006; use 5.8.x;> from warning as non-portable, attached.

I know this is very late, it didn't become an issue till build became 5.10.0
 
Robin Barker

--- pp_ctl.c.orig &nbsp; &nbsp;   2007-09-01 08:36:20.000000000 +0100
+++ pp_ctl.c
-3085,11 +3085,18
 
 &nbsp; &nbsp; sv = POPs;
 &nbsp; &nbsp; if ( (SvNIOKp(sv) || SvVOK(sv)) && PL_op->op_type != OP_DOFILE) {
- &nbsp; &nbsp; &nbsp; if ( SvVOK(sv) && ckWARN(WARN_PORTABLE) ) &nbsp; &nbsp; &nbsp; /* require v5.6.1 */
+ &nbsp; &nbsp; &nbsp; static bool portable = FALSE;
+ &nbsp; &nbsp; &nbsp; if ( !portable &&
+ &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp;  SvVOK(sv) && ckWARN(WARN_PORTABLE) ) &nbsp; &nbsp;  /* require v5.6.1 */
 &nbsp; &nbsp; &nbsp;   &nbsp; &nbsp; &nbsp;  Perl_warner(aTHX_ packWARN(WARN_PORTABLE),
 &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;   ; &nbsp; "v-string in use/require non-portable");
 
 &nbsp; &nbsp; &nbsp;  sv = new_version(sv);
+ &nbsp; &nbsp; &nbsp; if (PL_compcv &&
+ &nbsp; &nbsp; &nbsp;  &nbsp;  vcmp(sv, sv_2mortal(upg_version(newSVnv(5.006), FALSE))) >= 0)
+ &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  /*  version 5.006 recognises 5.x.y in C<use 5.x.y> so
+ &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; &nbsp;   ; can portably C<use 5.10.0> following C<use 5.006> */
+ &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  portable = TRUE;
 &nbsp; &nbsp; &nbsp;  if (!sv_derived_from(PL_patchlevel, "version"))
 &nbsp; &nbsp; &nbsp;   &nbsp;  upg_version(PL_patchlevel, TRUE);
 &nbsp; &nbsp; &nbsp;  if (cUNOP->;op_first-&gt;op_type == OP_CONST && cUNOP->op_first-&gt;op_private & OPpCONST_NOVER) {
--- t/lib/warnings/pp_ctl.orig  2006-06-13 20:29:31.000000000 +0100
+++ t/lib/warnings/pp_ctl
-240,3 +240,8
 &nbsp; &nbsp; eval 'print $foo';
 }
 EXPECT
+########
+# pp_ctl.c
+use warnings;
+eval 'use 5.006; use 5.10.0';
+EXPECT
End of patch


<<use_v-string_portable.patch>>

  
Re: use 5.010 is ugly; use 5.10.0 warns
user name
2007-09-25 08:38:53
On 18/09/2007, Robin Barker wrote:
> I don't like the warning from C<use 5.10.0> and I
don't like C<use 5010> - it doesn't say what I mean.
>
> I some of my modules I have used C<use 5.006; use
5.8.x;>
> as a portable way of way of C<use 5.8.x> without
writing C<use 5.00800x;>
>
> I have a patch which prevents C<use 5.006; use
5.8.x;> from warning as non-portable, attached.

That's a clever idea, perhaps a bit obscure. I don't like
the static
boolean variable though. Static variables are ungood. And
this implies
effect at distance (for example, eval("use
5.006");eval("use 5.10.0")
won't warn.) No real idea how to implement it differently
_and_ while
keeping it simple. Maybe a PL_use_vstring_ok is sufficient
for now --
but that doesn't get rid of the effect at distance. (and
your patch
has no docs)

> I know this is very late, it didn't become an issue
till build became 5.10.0

Re: use 5.010 is ugly; use 5.10.0 warns
user name
2007-09-25 15:03:27
On Tue, Sep 25, 2007 at 03:38:53PM +0200, Rafael
Garcia-Suarez wrote:
> That's a clever idea, perhaps a bit obscure. I don't
like the static
> boolean variable though. Static variables are ungood.
And this implies
> effect at distance (for example, eval("use
5.006");eval("use 5.10.0")
> won't warn.) No real idea how to implement it
differently _and_ while
> keeping it simple. Maybe a PL_use_vstring_ok is
sufficient for now --
> but that doesn't get rid of the effect at distance.
(and your patch
> has no docs)

Er, couldn't we reserve a $^H bit, or a %^H entry, for
this?

(Which would also allow 'use version' to set the bit, if it
should --
I've never been terribly clear on that.)

    -=- James Mastros

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )