Perl6 RFC Librarian wrote:
> =head1 ABSTRACT
>
> File tests (-r/-w/-x/...) made sense when Perl's shellness was an
> attribute. Most new Perl programmers are not coming from a shell
> programming background, and the -X syntax is opaque and bizarre.
> It should be removed.
> is_readable(file) is really -r(file)
If you are proposing complete removal of -X tests (as the RFC title
suggests) then I think the syntax definately needs more discussion.
I liked Nathan's suggestion (quoted below) and I've listed why I
think it's the better syntax.
It:
+ stacks multiple tests quite cleanly without excess verbiage
(if (-e && -T && -s && -x){...} gets a little tedious especially
if you don't use $_)
+ introduces only 1 new keyword ("file" seems bad, but maybe not)
+ does not break the brains of the -X loving crowd (as much)
+ introduce long names for -X haters
e.g. file($file, 'readable,writable,directory');
Nathan Wiger wrote:
>In fact, I'd much rather still a more generic function like 'want' that
>takes a list of things to check:
>
> file($file); # does it exist?
> file($file, 'r'); # is it readable?
> file($file, 'w'); # is it writable?
> file($file, 'd'); # is it a directory?
> file($file, 'wd'); # is it a writable directory?
> file($file, 'dw'); # same thing
>
> Otherwise we run the risk of 200 builtins just to check file types and
> modes on all the different platforms....
Clayton