|
|
|
good chemistry is complicated, and a little bit messy -LW |
|
| PerlMonks |
Inline Java in a Perl OO Moduleby tmaly (Monk) |
| on Nov 21, 2008 at 05:48 UTC ( [id://725057]=perlquestion: print w/replies, xml ) | Need Help?? |
|
tmaly has asked for the wisdom of the Perl Monks concerning the following question: I was able to get Inline::Java working from withing a perl OO module today. However, I was hoping to be able to put all of the inline code in one method and then be able to instantiate objects from this one instance of the inline code throughout the perl module. However, attempting to do this did not seem to work, and I was not able to persist the inline java to the rest of the perl object. I turned on the debug mode in inline and I saw that it was adding the java class to the namespace of the perl module as I was hoping for. But I wanted to avoid having to replicate the inline code in other methods throughout this module. I suspect the problem is related to lexical scoping and how inline java works. Has anyone accomplished anything like this before? Here is the pseudo code of what I hope to accomplish
Update: Thanks guys, I ended up putting the code outside as fmerges suggested. I stuck it in a second BEGIN block and I was able to call it as I was hoping to.
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||