There's more than one way to do things | |
PerlMonks |
Re: A Tricky Problem with Contextby stephen (Priest) |
on Apr 07, 2002 at 21:32 UTC ( [id://157312]=note: print w/replies, xml ) | Need Help?? |
Without knowing enough about VB, it's kind of difficult to solve the problem, but here are some pointers and suggestions... For general cases, you could refer to all variables through objects. It might make it easier for your compiler to refer to variables, since they'd be accessable in a more VBScript-type way. It would be be a little less efficient, but would give you a way of dealing with the fact that the thing named 'x' could be a list, a hash, or a scalar. Like so: And in VBVar.pm:
N.B. Code not tested, may not even compile, and should not be used directly; just trying to get the idea across. The advantage to this is that you can have the function that returns the value decide what kind of variable it is. You could also do the same thing by just returning references all the time, and have all of your functions check for type with 'ref' and take whatever action is appropriate. For information on tie, see perltie. stephen
In Section
Seekers of Perl Wisdom
|
|