dpuu wrote:
> Question: is it appropriate to P6 look&feel to have methods on
> functions?

I don't think that's such a good idea in this case. If a file is
chown'able is not a property of the chown function, but of the file.

> The definition of C<chown> includes the statement that it's not
> available on most system unless you're superuser; and this can be
> checked using a POSIX incantation. I was wondering if it would be
> reasonable to provide this as a method on the chown function, so that
> a user could say:
>   if &chown.is_restricted {
>     ...
>   }
>   else {
>     chown $user, $group <== @files
>   }

I'd rather go with the "try it and fail() if you can't" approach, partly
because of race conditions, partly because it's much more reliable in
the presence of extended security models (think of SeLinux for example).

If 'use fatal' is in effect, that dies, if not, you can check the return

For chmod() I could imagine an interface like this:

$file.chmod( :set, :user => :r & :x, :group => :r)
       # both same as 'chmod 540 $file'

$file.chmod( :modifiy, :other => :!x)
       # same as 'chmod o-x $file'


Moritz Lenz
http://perlgeek.de/ |  http://perl-6.de/ | http://sudokugarden.de/

Reply via email to