Scott Serr
Fri, 10 Oct 2008 10:13:36 -0700
Stefan Seifert wrote:
Agreed. I thought it might be easiest to have a handle to the list, as I know even LESS how to access the list from inside the module otherwise.On Friday 10 October 2008 05:12:08 Scott Serr wrote:I'm sorry if this is not the right place to ask, but here is my question... I want to abstract some complexities away from users, CLASSPATH and some other things. So I would like to wrap the Inline Java package in my own package, so to call the wrapper would look like this: use BOB ['JavaClass1', 'JavaClass2']; or even use BOB STUDY => ['JavaClass1', 'JavaClass2'];There's no need to pass an array reference here. Just a plain old list is all you need:use BOB qw(JavaClass1 JavaClass2);
perldoc perlmod and perldoc Exporter should give you all the info you need.
I've read those and unfortunately they didn't help me. (I'm not a Perl programmer, but that's probably not an excuse.)
Separate from Inline, Exporter seems like a way to expose module symbols to the caller. Maybe as they are exposed they can be filled out for a kind of 2 way communication.
This is what I have done: foo.pl: use strict; use warnings; use BOB STUDY => qw(JavaClass1); BOB.pm package BOB; use strict; use warnings; our @ISA = qw(Exporter); our @EXPORT_OK = qw(STUDY); print $STUDY, "\n"; My results: Global symbol "$STUDY" requires explicit package name at BOB.pm line 8. If tried a number of permutations! :)Instead of letting the user pass in the class list they want to use, I may need to just hard code all the classes they might use. I'm trying to clean up a really ugly usage (at work), but that method might be "good enough."
Thanks, -Scott