Re: How avoid "argument isn't numeric" warning when evaluating $VERSION?

[email protected] (David Golden) Thu, 3 Jan 2019 21:58:05 -0500
Newsgroups perl.cpan.workers
Message-ID <CAOeq1c_yvzRn0B_4Bz7zxk-4HApCiLAxScmzvCnQ8GqpON155w@mail.gmail.com>
--000000000000e12b17057e990de5
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Rather than test with ">=3D", you should use either UNIVERSAL::VERSION or
parse the module's version to a version.pm object first
(version->parse($Some::Module::VERSION).

David

On Thu, Jan 3, 2019 at 9:49 PM James E Keenan <[email protected]> wrote:

> Suppose that in package Someones::Module I have:
>
> #####
> $Someones::Module::VERSION =3D '1.4417_001';
> #####
>
> And then in a different module I have:
>
> #####
> die "Need more recent version of Someones::Module" unless
> $Someones::Module::VERSION >=3D "1.40";
> #####
>
> This will generate a warning like this:
>
> #####
> Argument "1.4417_001" isn't numeric in numeric ge (>=3D) at ...
> #####
>
> I would like to submit a patch for the relevant module.  What is the
> recommended way of numifying $Someones::Module::VERSION in the '>=3D'
> comparison?
>
> Or is there a better approach?
>
> Thank you very much.
> Jim Keenan
>


--=20
David Golden <[email protected]> =E2=80=A2 https://xdg.me/ =E2=80=A2 Twitter/GitHu=
b: @xdg

--000000000000e12b17057e990de5
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Rather than test with &quot;&gt;=3D&quot;, you should use =
either UNIVERSAL::VERSION or parse the module&#39;s version to a <a href=3D=
"http://version.pm">version.pm</a> object first (version-&gt;parse($Some::M=
odule::VERSION).<div><br></div><div>David</div></div><br><div class=3D"gmai=
l_quote"><div dir=3D"ltr">On Thu, Jan 3, 2019 at 9:49 PM James E Keenan &lt=
;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; wrote:<br><=
/div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bo=
rder-left:1px solid rgb(204,204,204);padding-left:1ex">Suppose that in pack=
age Someones::Module I have:<br>
<br>
#####<br>
$Someones::Module::VERSION =3D &#39;1.4417_001&#39;;<br>
#####<br>
<br>
And then in a different module I have:<br>
<br>
#####<br>
die &quot;Need more recent version of Someones::Module&quot; unless <br>
$Someones::Module::VERSION &gt;=3D &quot;1.40&quot;;<br>
#####<br>
<br>
This will generate a warning like this:<br>
<br>
#####<br>
Argument &quot;1.4417_001&quot; isn&#39;t numeric in numeric ge (&gt;=3D) a=
t ...<br>
#####<br>
<br>
I would like to submit a patch for the relevant module.=C2=A0 What is the <=
br>
recommended way of numifying $Someones::Module::VERSION in the &#39;&gt;=3D=
&#39; <br>
comparison?<br>
<br>
Or is there a better approach?<br>
<br>
Thank you very much.<br>
Jim Keenan<br>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
 class=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div=
 dir=3D"ltr"><div>David Golden &lt;<a href=3D"mailto:[email protected]" target=3D"=
_blank">[email protected]</a>&gt; =E2=80=A2 <a href=3D"https://xdg.me/" target=3D"=
_blank">https://xdg.me/</a> =E2=80=A2 Twitter/GitHub: @xdg</div></div></div=
></div></div></div></div>

--000000000000e12b17057e990de5--