Re: Java 1.4.1 and Perl CORBA::ORBit



Sam,

Maybe I am doing something wrong... :)

Here is my Perl client and my idl:

-------------------------------------------------------------
#!/usr/bin/perl

use CORBA::ORBit idl => [
'/home/jason/projects/personal/corbatest/Solver.idl',
'/usr/share/idl/orbit-1.0/CosNaming.idl' ];

use CORBA::ORBit::LongDouble;
use Error qw(:try);

use strict;

# initialise the CORBA ORB
my $orb = CORBA::ORB_init('orbit-local-orb');

# get IOR
my @iorA = <STDIN>;
my $ior = @iorA[0];
$ior =~ s/\n//g;

# Get POA?
my $poa = $orb->resolve_initial_references("RootPOA");

my $namingContext = $orb->string_to_object($ior);

# The name registered by te Java "server"
my $name = [{id => "Solver", kind => ""}];

my $solver = $namingContext->resolve($name);
#print "server is $solver\n";  # this prints out
corbatest::Solver=SCALAR(0x82094d0)
my $doo = "wake up!";
$solver->setFoo($doo);  # this is where we hang!
print "did he wake up?\n";
print "the message is \"" . $solver->getMessage() . "\"\n";

my $problem = corbatest::ProblemSet->new();
$problem->setValue(new CORBA::LongDouble "137.99");
print "problem value is " . $problem->getValue() . "\n";
print "the problem is a " . $problem . "\n";

$solver->solve($problem, 1);

print "the solution is " . $problem->getSolution() . "\n";

## the ProblemSet object
package corbatest::ProblemSet;

@corbatest::ProblemSet::ISA = qw(POA_corbatest::ProblemSet);
 
sub new {
	my $invocant = shift;
	my $class = ref($invocant) || $invocant;
	my $self = {
		value => undef,
		solution => undef,
	};
	return bless $self, $class;
}

sub getValue {
	my $self = shift;
 	return $self->{value};
}

sub setValue {
	my $self = shift;
	$self->{value} = shift;
	return;
}

sub getSolution {
	my $self = shift;
  	return $self->{solution};
}

sub setSolution {
	my $self = shift;
	$self->{solution} = shift;
	return;
}
-------------------------------------------------------------
module corbatest {

	interface ProblemSet {
 		double getValue();
		void setValue(in double v);
		double getSolution();
		void setSolution(in double s);
	};

	interface Solver {
		boolean solveCurrent();

		boolean solve(inout ProblemSet s, in long numIters);

		ProblemSet getProblem();
		void setProblem(inout ProblemSet p);

		unsigned long getIterations();
		void setIterations(in unsigned long i);

		string getMessage();
		void setFoo(in string foo);
	};

};
-------------------------------------------------------------

Obviously the server would help you run it, but I am hoping that I am
just using the CORBA::ORBit package incorrectly...

Thanks!
Jason


On Tue, 2002-10-29 at 18:25, Sam Couter wrote:
> Jason Crickmer <jason@agentelf.com> wrote:
> > Sam,
> > 
> > Any recommendations on a particular Java version?
> 
> I am successfully using:
> 
> sam@hathor:~$ /usr/local/jdk/bin/java -version
> java version "1.3.1_01"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_01)
> Java HotSpot(TM) Client VM (build 1.3.1_01, mixed mode)
> sam@hathor:~$
> 
> on Debian woody i386, both with whatever default kernel woody ships with
> and with kernel 2.4.20-pre7-ac3.
> -- 
> Sam "Eddie" Couter  |  mailto:sam@couter.dropbear.id.au
> Debian Developer    |  mailto:eddie@debian.org
>                     |  jabber:sam@jabber.topic.com.au
> OpenPGP fingerprint:  A46B 9BB5 3148 7BEA 1F05  5BD5 8530 03AE DE89 C75C





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]