go ahead... be a heretic | |
PerlMonks |
Encapsulate function and variablesby nictam (Initiate) |
on Jun 19, 2007 at 11:34 UTC ( [id://621992]=perlquestion: print w/replies, xml ) | Need Help?? |
nictam has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks, here is what I'd like to be able to implement: - creates variables and/or functions in file foo.pl. e.g.:
- now I would like to load this file so that its content is encapsulated either in a hash table or in an object. E.g. in file main.pl, I would like to use a function such as capsule that would create such object: so that I can now access $obj{"text"}, or $obj->text... I could also call $obj->func(). - in general there would be many different files such as foo.pl, and I want to access all variables from a top-level script. In fact I want to make all declarations from foo.pl which seem to be global, as local from the top level script. I don't want to use different namespaces. thanks in advance! nictam
Back to
Seekers of Perl Wisdom
|
|