develooper Front page | perl.perl5.porters | Postings from April 2006

RE: [perl #38965] [RESOLVED] File::Find documentation - is "Don't modify these variables" still valid?

From:
Davies, Alex
Date:
April 24, 2006 15:54
Subject:
RE: [perl #38965] [RESOLVED] File::Find documentation - is "Don't modify these variables" still valid?
Message ID:
A69AA663CE9BBC44AE1DA72483DE15DE033D55BF@HQ-MAIL3.ptcnet.ptc.com
> -----Original Message-----
> From: Steve Peters via RT [mailto:perlbug-followup@perl.org] 
> Sent: 24 April 2006 17:46
> To: Davies, Alex
> Subject: [perl #38965] [RESOLVED] File::Find documentation - is
> "Don't modify these variables" still valid? 
> 
> According to our records, your request regarding 
>   "File::Find documentation - is "Don't modify these variables" still
> valid?"  has been resolved. 
> 
> If you have any further questions or concerns, please respond to this
> message.
> 

Looking at the patch - it now suggests that C<$File::Find::dir>
can be modified.

I don't think this is the case. Consider line ~883:

for my $FN (@filenames) {
  next if $FN =~ $File::Find::skip_pattern;
  $name = $dir_pref . $FN; # $File::Find::name
  $_ = ($no_chdir ? $name : $FN); # $_
  { $wanted_callback->() }; # protect against wild "next"
}

Changing C<$dir> from the wanted_callback does break functionality,
as subsequent times thro' the above loop will see the modified
value. (Also see the code i posted in my follow up message.)

My original bug submission was wrong to suggest that all
three variables are modifiable - apologies there.
I believe it is safe to modify C<$File::Find::name> and
more usefully C<$_>.

Thanks & Best regards.

> For other topics, please create a new ticket.
> 
> Please don't feel obligated to say "Thanks" or "Kudos" or "I owe you
> a beer" -- if you respond to this message it will reopen the ticket.
> If you must, please send email directly to the person who handled
> your ticket, and not to the tracking system.
> 
> <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=38965 >



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