Hi,
I am developing Perl wrappers for Java Code using
Inline-Java. I need to pass an array of Java objects
and an array of string to the constructor. The
constructor is defined as:
public MyClassConstructor(JavaArray[] javaArray,
String[] strArray);
Corresponding to the above constructor, I have
developed a wrapper as:
sub new{
my $class = shift;
my $java_array = shift;
my $str_array = shift;
my $obj = MyClassConstructor->new(???,???);
return bless {
obj => $obj,
}, $class;
}
Now my question is, how do I pass the arrays to the
constructor. If I use:
MyClassConstructor->new([EMAIL PROTECTED],[EMAIL PROTECTED]),
I get the error:
A Java array can only contain scalars, Java objects or
array reference...
I have used all combinations, and nothing seems to
work.
BTW, the client code is calling the wrappers as shown
below:
my @java_arr;
my $java_comp = new JavaArray;
push @java_arr, $java_comp;
my @str_arr;
push @str_arr,"mystring";
my $obj = perlClass->new([EMAIL PROTECTED],[EMAIL PROTECTED]);
I am not sure what I am missing in the above code.
Any help would be appreciated.
Thanks,
Sharmishtha
____________________________________________________________________________________
Building a website is a piece of cake. Yahoo! Small Business gives you all the
tools to get online.
http://smallbusiness.yahoo.com/webhosting