develooper Front page | perl.perl5.porters | Postings from December 2009

Re: [perl #70802] -i'*' refuses to work

Thread Previous | Thread Next
From:
Rafael Garcia-Suarez
Date:
December 3, 2009 01:24
Subject:
Re: [perl #70802] -i'*' refuses to work
Message ID:
b77c1dce0912030124w3707a408p7e1436dbd37162a0@mail.gmail.com
2009/12/1 Tony Cook <tony@develop-help.com>:
> On Wed, Nov 25, 2009 at 02:31:49AM -0800, Frank Wiegand wrote:
>> perldoc perlrun says about -i:
>>
>>   These sets of one-liners are equivalent:
>>
>>     $ perl -pi -e 's/bar/baz/' fileA            # overwrite current file
>>     $ perl -pi'*' -e 's/bar/baz/' fileA         # overwrite current file
>>
>> But they aren't:
>>
>>   % touch fileA
>>   % perl -pi -e 's/bar/baz/' fileA
>>   % perl -pi'*' -e 's/bar/baz/' fileA
>>   Can't do inplace edit on fileA: File exists.
>>
>> This is broken at least since 5.6.2 and still in 5.11.2.
>
> I'm kind of tempted to call this a documentation bug, since supporting
> it might have people expecting:
>
>  ln -s . foo
>  perl -pi'foo/*' -e '...'
>
> to work.
>
> But I've attached a patch that fixes the immediate problem.

Thanks, applied.

Thread Previous | 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