Hi Scott,


>
> I can help you with the CPAN account for sure.  Web over to
> http://www.cpan.org/modules/04pause.html and read all about PAUSE (The
Perl
> Authors Upload Server).  It can take 3 or 4 weeks for your request to be
> processed.
>
> I may be able to help you test on an ActiveState platform as well.
>
> I have a few questions.  1)  Where does the InlineJavaServer daemon run?
> Locally or on some server?  Does it start and stop as needed or is it
> something that needs to run all the time?

The server is run locally on a configurable port (default is 7890).
Inline::Java starts it when it
loads the Java code and stops it (at least it does it's best to...) when the
Perl scritp exits. Currently
if you hava many Inline::Java sections, one server will start for each
section (incrementing the port number:
7890, 7891, 7892, ...).

When I have the time I'll look at Inline 0.32 and see how the Global stuff
is implemented.

>
> 2)  How do you deal with casting in Java?  For example (and not a very
good
> one):  What if I have a Java method (writeMeABook) that returns a generic
> object called book.  But I need the setAntagonist() method only contained
> in an object called novel (novel is a subtype of book).  In Java I could
do
> this:
>
>      novel n = (novel) writeMeABook();
>      n.setAntagonist("John Doe");
>
> to cast the book returned by the method to the specific subtype I need,
> novel.  My confusion arises when trying to do a similar sort of thing from
> Perl.
>
>      $n = writeMeABook()         # returns a book object
>      $n->setAntagonist("John Doe")       # fails because $n is a book and
> not a novel
>
> How do I cast $n to a novel without explicitly writing a Java method that
> does casting?  Is this clear as mud?
>

I must admit that I have not though of this casting business yet. I suppose
a solution
like this might work, but I'm not sure:

$n = writeMeABook()                    # returns a book object
novel->__cast($n) ;
# this would rebless $n as a novel object, therefore allowing you to access
the novel methods.
# But then on the Java side the object created should in fact be a novel,
since you're
# trying to cast it as such, so the call should work
$n->setAntagonist("John Doe")       # fails because $n is a book and

Let me know what you think...
I'll try to find the time to work out an example...

> I ask because I am wrestling with this issue in the JPL stuff I am doing
> right now.  Short of writing a Java method for each cast that I want to
do,
> I have no answer.
>
> Cheers,
> Scott.
>
> ====================================================
> M. Scott Roth,
> <[EMAIL PROTECTED]>
> Information Systems Engineer
> Science Applications International Corporation
> 703-375-2260
> ========================<><=========================
>
>

Cheers,
Patrick

Reply via email to