develooper Front page | perl.perl5.porters | Postings from August 2014

[perl #122547] no_chidr find() option in t/porting/dual-life.t

Thread Next
From:
James E Keenan via RT
Date:
August 19, 2014 22:46
Subject:
[perl #122547] no_chidr find() option in t/porting/dual-life.t
Message ID:
rt-4.0.18-23036-1408488353-1278.122547-15-0@perl.org
On Sat Aug 16 15:21:17 2014, jkeenan wrote:
> On Sat Aug 16 08:11:10 2014, jkeenan wrote:
> > On Sat Aug 16 07:23:36 2014, jhi wrote:
> > > grep no_ch t/porting/dual-life.t
> > >    { no_chidr => 1, wanted => sub {
> > >
> > > The primary issue is that the option is misspelled.
> > >
> > > The secondary issue is whether the script works as intended (1) now
> > > (2) after the option is corrected.  (Unknown.)
> > >
> > > The tertiary issue is that File::Find probably should be more
> > > aggressive about unknown options.
> >
> > I'll prepare a patch for the tertiary issue.  Should be ready within
> > a
> > day or two.  If in the meantime, someone else wants to look at the
> > primary and secondary issues, that would be great.
> >
> 
> Attached please find a patch which addresses the primary and tertiary
> issues described by Jarkko.  This is also being smoked at smoke-
> me/jkeenan/122547-file-find-options.
> 
> As for the secondary issue ... I was not previously familiar with
> t/porting/dual-life.t, so what follows may be incorrect.  According to
> an inline comment, its purpose is:
> 
> #####
> # This tests properties of dual-life modules:
> #
> # * Are all dual-life programs being generated in utils/?
> #####
> 
> In any event, I ran t/porting/dual-life.t in both blead and my branch
> and, accounting for sort order, got the same output from each.
> 
> You will note that in the commit message I stated that this patch
> should not be applied until we can assess its impact on CPAN
> distributions like File-Find-Rule.  Since File::Find is functional,
> not object-oriented and not made to be inherited from, I don't think
> there should be any downstream breakage on CPAN.  I manually tested
> these CPAN distros and got no test breakage:
> 
> #####
> File-Find-Rule-0.33
> File-Find-Wanted-1.00
> File-Find-Closures-1.10
> File-Find-Parallel-0.52
> #####
> 
> In File::Find, the "no_chdir" option is documented as follows:
> 
> #####
> "no_chdir"
>    Does not "chdir()" to each directory as it recurses. The "wanted()"
>    function will need to be aware of this, of course. In this case, $_
> will
>    be the same as $File::Find::name.
> #####
> 
> Once the spelling error is corrected, the relevant find() function in
> dual-life.t is:
> 
> #####
> find(
>   { no_chdir => 1, wanted => sub {
>     my $name = $File::Find::name;
>     return if $name =~ /blib/;
>     return unless $name =~ m{/(?:bin|scripts?)/\S+\z} && $name !~
> m{/t/};
> 
> push @programs, $name;
> }},
> qw( ../cpan ../dist ../ext ),
> );
> #####
> 
> This usage of 'no_chdir' seems to meet the criteria specified in the
> documentation.
> 
> Thank you very much.
> Jim Keenan

Rik, Peter,

Could you evaluate this patch, particularly whether you think there's any downstream risk?

If you like it, you can merge it and include it in the monthly release.

Thank you very much.
Jim Keenan


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=122547

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About