in reply to Re: Restricted' data, a clarification
in thread 'Restricted' data, an additional security mechanism for Perl.
Fair enough. Safety belts are good. I understand now.
But if I may, I'd like to polish up the API quite a bit. This should be equivalent in goal and allows for the restricting code to be given by the restrictor, not the one using the restricted data. So this is much more safe and allows for writing the protection routine only once.
May I suggest:
AND also (if you want death) you have choices:use Restricted; RESTRICT $creditCard, sub { someMangling($_); }; print $creditCard; # only shows last four print UNRESTRICT($creditCard); # prints whole number print $creditCard; # var is restricted here as well
use Restricted; RESTRICT $creditCard, sub { die "locked variable!" }; print $creditCard; # KABOOM! print UNRESTRICT($creditCard); # OK
Seems much more straight forward as an API to me. I could live with (and actually like and use) this interface. Needs to be extended to support non-scalar data structures though, but I suppose restricting references would serve appropriately.
Comments?
|
---|