Not only .indir default is strange, but the behavior of .chdir it relies
on is weird too.
I would like .chir :$test to support String|Code or array of thereof so as
to dwim
:test<rw> # read/writeable by user
:test<r w> # same
:test< arw > # same but for all, patterned
after chmod
:test< ---rx-rwx > # patterned after ls -a (one
stat(2))
Or is this overengineering ?
The current code in .chdir looks like a placeholder for something to come.
if $test eq 'r' {
return $dir if $dir.r;
}
elsif $test eq 'r w' {
return $dir if $dir.r and $dir.w;
}
elsif $test eq 'r w x' {
return $dir if $dir.r and $dir.w and $dir.x;
}
On Fri, Dec 30, 2016 at 11:06 PM, brian d foy <[email protected]>
wrote:
> # New Ticket Created by "brian d foy"
> # Please include the string: [perl #130460]
> # in the subject line of all future correspondence about this issue.
> # <URL: https://rt.perl.org/Ticket/Display.html?id=130460 >
>
>
> indir is in S16 but not documented elsewhere, but it's a really cool
> feature that I think many people will find useful. It's certainly much
> more convenient
>
> indir '/Users/brian', {
> put "Directory is $*CWD";
> }
>
> indir '/etc', {
> put "Directory is $*CWD";
> }
>
> The second one fails with
>
> Failed to change the working directory to '/etc': did not pass 'd r w'
> test
>
> I don't know why it insists that the directory be writable, expecially
> when chdir itself is not as strict. I often change to a directory where
> I want to merely read files, so I'd like to see the test relaxed.
>
> And, since its undocumented, nobody else knows that it does this
> currently. :)
>
--
cognominal stef