Shankar,
You can't do that directly, but you could use a HashMap and some kind of wrapper
function as such:
#!/usr/bin/perl
use Inline (
Java => 'DATA',
AUTOSTUDY => 1,
) ;
my $map = test->getmap() ;
hash_wrapper('do_search', $map) ;
sub hash_wrapper {
my $func = shift ;
my $hm = shift ;
my %h = () ;
foreach my $k (@{$hm->keySet()->toArray()}){
$h{$k} = $hm->get($k) ;
}
$func->(%h) ;
}
sub do_search {
my %args = @_ ;
print join(", ", map {"$_ => $args{$_}"} keys %args), "\n" ;
}
__DATA__
__Java__
import java.util.* ;
class test {
static public HashMap getmap(){
HashMap h = new HashMap();
h.put("a", "1") ;
h.put("b", "2") ;
h.put("c", "3") ;
return h ;
}
}
Patrick
On 2/13/07, Shankar Vasudevan <[EMAIL PROTECTED]> wrote:
Hi,
I have a legacy perl module written about 5 years back and now we are
writing a enterprise Java application that encapsulates the business
logic written in Perl.
Now the method in perl takes a hash as a parameter like <code>
sub do_search {
my %args = @_;
</code>
Is it possible with Inline Java to be able to directly pass in a hash
object and retrieve hash objects? Or if that is not possible, what is
the alternative way of doing this?
Thanks for your replies.
Shankar
--
=====================
Patrick LeBoutillier
Laval, Québec, Canada