Hi, I'd like my Java to call an already instantiated perl object.  I tried the 
code below (plus other variations), but can't seem to make the right 
incantation.

Is this possible?

Thanks
Jay

#!/usr/bin/perl

package SomeObject;

sub new {
    my $class = shift;

    bless {}, $class;
}

sub logic {

    my ($self, $arg) = @_;
    print "in logic: $arg \n";
}

package main;


use Inline Java => <<'END';
    import org.perl.inline.java.* ;
    
    class callback extends InlineJavaPerlCaller { 
        String ObjName;
        public callback(String Name) throws InlineJavaException {
            ObjName = Name;
        }

        public void perl() throws InlineJavaException, 
                                    InlineJavaPerlException {

            CallPerlSub(ObjName+"->logic()", new Object [] {}) ;
        }
    }
END


my $obj = SomeObject->new();
my $c = callback->new($obj);
$c->perl();

Reply via email to