On Jan 26, 2011, at 4:58 PM, VANOLE, MICHAEL J (ATTSI) wrote:
> Hi, this may be a basic perl question. I'm using inline::java to execute
> some public methods like this one:
>
> public User findUserByLogin(String loginName, boolean populate)
> {
> User ret = null;
> try {
> ret = impl.findUserByLogin(loginName, populate);
> } catch (ExecuteException e) {
> this.trapError(1, "Error looking up user.
> loginName=" + loginName
> + " populate =" + populate +
> "\nERROR:"
> + e.getMessage(), e);
> }
> return ret;
> }
>
> I call it:
> $obj = $mstdAdmin->findUserByLogin('myuserid',1);
>
> Print "$obj\n";
> Inline::Java::Object=HASH(0xaae924)
>
> I'm having a helluva time trying to dereference this
>
> %hash = %$obj;
> foreach my $k (keys %hash) {print "$k: $hash{$k}\n";
> prints nothing.
>
I don't really quite understand what you're trying to do.
What do you expect it to print?
You've returned a User object. What are it's public methods? What happens when
you call them?
You have a reference to a java object. The proxy details aren't that important,
but you should be calling whatever public methods are actually implemented by
your object.
For instance, if User had something like:
public String getFirstName(){
return firstName;
}
On the perl side you could do:
$name = $obj->getFirstName();
Does that help you?
--
Jason Stelzer
[email protected]