Subject: | Can't call method "__isa" without a package or object reference |
Date: | Sun, 1 Sep 2013 00:45:39 +0300 |
To: | <bug-Inline-Java [...] rt.cpan.org> |
From: | "Mikko Noromaa" <mikko [...] noromaa.fi> |
Hello!
I am running Inline::Java 0.53 on 32-bit Perl 5.14.2 on Windows 7. I have a
Java object and can call it successfully from Perl. My script has already
done thousands of such calls without any problems. Just now, however, I got
a very strange error during my regular use of the Perl script:
Thread 3 terminated abnormally: In method new of class NCalc::NCalculator:
Can't find any signature that matches the arguments passed
(ARRAY(0x6c8918c), ARRAY(0x712f57c), ARRAY(0x712eccc), 0, 0).
Available signatures are:
static new([D, [D, [D, double, int, double, boolean, boolean,
boolean)
error was: Wrong number of arguments at
C:/Perl/site/lib/Inline/Java/Object.pm line 107 thread 3
static new([D, [D, [D, int, int)
error was: Can't call method "__isa" without a package or
object reference at C:/Perl/site/lib/Inline/Java/Array.pm line 48, <GEN7>
line 6973.
at NCalc.pm line 33 thread 3
As you can see above, my Java class has two constructor signatures, the
latter of which should be called. As far as I can tell, I am calling it with
correct arguments.
NCalc.pm line 33 reads:
return NCalc::NCalculator->new(@_);
Even though I use threads, I call Java objects only from a single thread.
The passed arrays are shared, but not modified by other threads after being
created.
When looking at Array.pm, I see the following:
sub new {
[...]
my @this = () ;
my $knot = tie @this, $class ;
my $this = bless (\@this, $class) ;
$OBJECTS->{$knot} = $object ;
[...]
}
sub DESTROY {
my $this = shift ;
my $knot = tied @{$this} ;
if (! $knot){
Inline::Java::debug(4, "destroying
Inline::Java::Array::Tie") ;
$OBJECTS->{$this} = undef ;
}
else{
Inline::Java::debug(4, "destroying Inline::Java::Array") ;
}
}
Could it be that $OBJECTS->{$knot} is not freed properly? If Perl reuses the
same ARRAY memory location, it could lead to clashes since that is used as
the key to %$OBJECTS. This is just a weak theory, I haven't studied the
Inline::Java code almost at all. However, this would explain the rare
occurrence of this problem (currently only once for me).
--
Mikko Noromaa (mikko@noromaa.fi) - tel. +358 40 7348034