Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 57607
Status: resolved
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: TODDR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 3.31
Fixed in: (no value)



Subject: Cwd does eval $VERSION
The code for Cwd.pm does "eval $VERSION". I know of no useful reason to do so. Doing so breaks B::C. Could this be removed in the next release please?
Subject: patch.txt
diff --git a/Cwd.pm b/Cwd.pm index a5e2cda..bf51a32 100644 --- a/Cwd.pm +++ b/Cwd.pm @@ -173,7 +173,6 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION); $VERSION = '3.31'; my $xs_version = $VERSION; -$VERSION = eval $VERSION; @ISA = qw/ Exporter /; @EXPORT = qw(cwd getcwd fastcwd fastgetcwd);
Subject: Re: [rt.cpan.org #57607] Cwd does eval $VERSION
Date: Wed, 19 May 2010 11:26:34 +0200
To: bug-PathTools [...] rt.cpan.org
From: Steffen Mueller <smueller [...] cpan.org>
Todd Rinaldo via RT wrote: Show quoted text
> Tue May 18 16:34:55 2010: Request 57607 was acted upon. > Transaction: Ticket created by TODDR > Queue: PathTools > Subject: Cwd does eval $VERSION > Broken in: 3.31 > Severity: Normal > Owner: Nobody > Requestors: TODDR@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=57607 > > > > The code for Cwd.pm does "eval $VERSION". I know of no useful reason to do so. Doing so > breaks B::C. Could this be removed in the next release please?
It's for stripping the underscore in development versions, if I remember correctly. I don't think we can sanely remove it. For the record, this isn't such an uncommon practice! Why does this break B::C? I think it'll have to work around this thing by itself as Cwd isn't the only module doing that. --Steffen
Show quoted text
> > The code for Cwd.pm does "eval $VERSION". I know of no useful reason
> to do so. Doing so
> > breaks B::C. Could this be removed in the next release please?
> > It's for stripping the underscore in development versions, if I > remember > correctly. I don't think we can sanely remove it. For the record, this > isn't such an uncommon practice! > > Why does this break B::C? I think it'll have to work around this thing > by itself as Cwd isn't the only module doing that.
We compile about 120 modules. This is the only one we have to patch. You could do this...? $VERSION =~ s/_\d+\s*$//;
Perl has no issues with underscores in a number why do you need to eval it away? seems like an unnecessary step every time someone uses the module.
Subject: Re: [rt.cpan.org #57607] Cwd does eval $VERSION
Date: Wed, 19 May 2010 16:51:01 +0200
To: bug-PathTools [...] rt.cpan.org
From: Steffen Mueller <smueller [...] cpan.org>
Hi Todd, Todd Rinaldo via RT wrote: Show quoted text
> Queue: PathTools Ticket <URL: > https://rt.cpan.org/Ticket/Display.html?id=57607 > > > Perl has no issues with underscores in a number why do you need to > eval it away? seems like an unnecessary step every time someone uses > the module.
All I remember without research is that it was necessary for the XS / XSLoader's version checking. See also: https://rt.cpan.org/Public/Bug/Display.html?id=41719 I'm still waiting for you to supply a compelling reason why you want this changed in Cwd. Working around something unknown relating to B::C (which is highly experimental, by the way) doesn't seem like a good reason to me. Best regards, Steffen
On Wed May 19 09:53:25 2010, TODDR wrote: Show quoted text
> Perl has no issues with underscores in a number why do you need to > eval it away?
Because it's not a number at that point, it's a string. The eval turns it into a number. Without the eval (or a s///, or whatever) you get wrong results: % perl -le 'use strict; my $x = "12.04_05"; print 3+$x' 15.04 % perl -le 'use strict; my $x = "12.04_05"; print 3+eval($x)' 15.0405 Steffen is correct that the reason is for the XS version checking, which is pretty strict on what it allows. Also, (perhaps you know this already, but just for the record) using the underscore indicates an alpha/beta version, and necessitates making $VERSION a string; however, XS requires a numeric version, not a string, and therefore whatever solution we come up with is bound to be ugly in one way or another because of this fundamental incompatibility. Perl versions just kind of suck.
Show quoted text
> Because it's not a number at that point, it's a string. The eval turns > it into a number. Without the eval (or a s///, or whatever) you get > wrong results: > > % perl -le 'use strict; my $x = "12.04_05"; print 3+$x' > 15.04 > % perl -le 'use strict; my $x = "12.04_05"; print 3+eval($x)' > 15.0405
Wow, that really does suck. Thanks for the info. We'll continue to patch around this. FYI B::C isn't as experimental as you think it is. It should be working on 5.12 by EOY.
Subject: Re: [rt.cpan.org #57607] Cwd does eval $VERSION
Date: Wed, 19 May 2010 12:48:11 -0500
To: bug-PathTools [...] rt.cpan.org
From: Ken Williams <kwilliams [...] cpan.org>
On Wed, May 19, 2010 at 12:39 PM, Todd Rinaldo via RT < bug-PathTools@rt.cpan.org> wrote: Show quoted text
> > FYI B::C isn't as experimental as you think it is. It should be working on > 5.12 by EOY. >
Yeah, I looked into the recent work on B::C, I was unaware it had been resurrected. Cool. -Ken
From: bitcard [...] volkerschatz.com
Show quoted text
> I'm still waiting for you to supply a compelling reason why you want > this changed in Cwd.
Choosing the regex over eval would retain trailing zeros, which would make the version more readable. I have encountered version 3.3 in File::Spec::Unix, which means 3.30, not 3.03. This is not obvious to the uninitiated.
On Wed May 19 10:51:11 2010, SMUELLER wrote: Show quoted text
> Hi Todd, > > Todd Rinaldo via RT wrote:
> > Queue: PathTools Ticket <URL: > > https://rt.cpan.org/Ticket/Display.html?id=57607 > > > > > Perl has no issues with underscores in a number why do you need to > > eval it away? seems like an unnecessary step every time someone uses > > the module.
> > All I remember without research is that it was necessary for the XS / > XSLoader's version checking. > > See also: https://rt.cpan.org/Public/Bug/Display.html?id=41719 > > I'm still waiting for you to supply a compelling reason why you want > this changed in Cwd. Working around something unknown relating to B::C > (which is highly experimental, by the way) doesn't seem like a good > reason to me.
I have a compelling reason: =~ y-_-- is about 60 times the speed. Cwd will start up more quickly.
On Sat Dec 17 01:58:42 2011, SPROUT wrote: Show quoted text
> On Wed May 19 10:51:11 2010, SMUELLER wrote:
> > Hi Todd, > > > > Todd Rinaldo via RT wrote:
> > > Queue: PathTools Ticket <URL: > > > https://rt.cpan.org/Ticket/Display.html?id=57607 > > > > > > > Perl has no issues with underscores in a number why do you need to > > > eval it away? seems like an unnecessary step every time someone uses > > > the module.
> > > > All I remember without research is that it was necessary for the XS / > > XSLoader's version checking. > > > > See also: https://rt.cpan.org/Public/Bug/Display.html?id=41719 > > > > I'm still waiting for you to supply a compelling reason why you want > > this changed in Cwd. Working around something unknown relating to B::C > > (which is highly experimental, by the way) doesn't seem like a good > > reason to me.
> > I have a compelling reason: =~ y-_-- is about 60 times the speed. Cwd > will start up more quickly.
This change was made long ago. I don’t have permission to resolve this ticket.