in reply to There is a way to LOCK a SCALAR?

I know you're nervous about someone untieing a tied scalar, but I couldn't help but at least look into CPAN to see what I could turn up anyway.

Tie::Scalar::RestrictUpdates is the first thing I found. Look at the POD, and you'll see that when you tie it, you tell the class how many times you'll allow that scalar to be updated or changed. After that number is reached (could even be 1 if you want), the scalar can no longer be modified.

You're worried that someone would untie it, but realistically there isn't much someone couldn't do if he/she wanted. Someone could even completely rewrite your code, or abandon it altogether because of inflexibility. You can't really stop a developer from having his way with your code, if he has access to it. You may contrive an elaborate means of preventing a variable from being changed by a developer, but you can't lock him out of your code entirely, while at the same time giving him access to your code.


Dave