in reply to Re: Matching and order of evaluation
in thread Matching and order of evaluation

So then, so that I'm clear - if I control the input and know its going to be mundane perl then I can do what I've always done ($x = $x + 1) but if I'm writing module code that accepts input from the user then I've got to be pessimistic and use a temp variable or something to shield myself from the user's magic?
  • Comment on Re: Re: Matching and order of evaluation

Replies are listed 'Best First'.
Re: Matching and order of evaluation
by Abigail-II (Bishop) on Oct 27, 2003 at 22:17 UTC
    You won't be able to shield yourself from the user's magic. You got to get the value of variable, and if it has get-magic, it's magic will be triggered, whether you put the value in a tmp variable, or in an expression. Furthermore, at the end, you're going to put the value back, so any set-magic will be triggered. Regardless whether you used a temp variable in between. But even if there's a way to avoid magic (in some cases, the use of temp variables can circumvent overload magic), in general you shouldn't. The user put that magic there for some reason (persistency, for instance), and would not expect a module to go out of its way to avoid it.

    Abigail