develooper Front page | perl.perl5.porters | Postings from November 2001

Re: [PATCH] core-only patch for clamp/readonly hashes

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
November 1, 2001 03:57
Subject:
Re: [PATCH] core-only patch for clamp/readonly hashes
Message ID:
20011101115734.6376.3@bactrian.elixent.com
Jeffrey Friedl <jfriedl@yahoo.com> writes:
>Nick Ing-Simmons <nick.ing-simmons@elixent.com> wrote:
>|> As the 'w' bit occurs on both directories and files, so the
>|> SvREADONLY can occur on both the hash and the value(s) it contains.
>|>
>|> directory  file                                  hash       value
>|>    rw-     rw-       Can do anything              --          --
>|>    rw-     r--       Cannot change file           --          RO
>|>    r--     rw-       Cannot delete/add file       RO          --
>|>    r--     r--       Can only read file           RO          RO
>|>
>|> The analogy is not perfect because it is proposed one can delete things
>|> from a "restricted" hash.
>
>I think the analogy is also missing that with a restricted hash (or,
>perhaps, "enumerated-key hash"), it is an error to try to access, other than
>with exists(), a non-approved (non-enumerated) key.

But if directory is not writeable then

  cat Quit

will give an error, (as will rm Quit and touch Quit)
so I think analogy does hold.


>
>If a hash's approved keys are: Verbose, Quiet and one tries to access
>{Verbose}, you'll get its value if it has one, or undef if it doesn't. But
>if one tries to use {Quite} (note misspelling), it is an error. This
>functionality is orthoginal to any full or partial readonlyness of the hash
>keys.
>
>Yes, it seems that "enumerated-key hash" is the best description.
>Perhaps even better than "clamp" :-)

I think "enumerated hash" would suit me fine.


>        Jeffrey
--
Nick Ing-Simmons
http://www.ni-s.u-net.com/



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