-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Feb 13, 2007, at 3:27 PM, Shankar Vasudevan 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?
The answer is 'sort of'. You could always use a tied hash. Implement
a perl class that implements the needed hash functionality that will
wrap the java HashMap. Then pass that object around and treat it as a
normal hash on the perl side. This means you wont have to change much
existing perl code and your java->perl marshalling will be handled in
a few discreet places.
See "perldoc perltie" for more details/examples. Note, I'm using a
fairly current version of perl so you may have to do a little
research before you can determine if this method is viable.
- --
J.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (Darwin)
iD8DBQFF0poJvxud+cMTf5IRAoHpAJ9dOifHa6k4LtCV3bYfEPAaBidiyQCfQble
pNDwKh1sJxGaXvr5Ksjq13Y=
=N6sj
-----END PGP SIGNATURE-----