Dear Patrick,
I've installed Inline::41 and Inline::Java 2.2
It works!
Thank you, that you thought about exit-code!
But some problems still stay:
Problem 1. Your signal-processing may cause memory-leak:
$SIG{__DIE__} = sub {
# Setting this to -1 will prevent Inline::Java::Object::DESTROY
# from executing it's code for object destruction, since the state
# in possibly unstable.
$DONE = -1 ;
die @_ ;
} ;
And it happens really by me !!! - even in such small program like:
===========================================================
use strict;
use Inline( JAVA => 'STUDY',
STUDY => ['java.util.Hashtable'],
);
my java::util::Hashtable $h;
while (1){
$h=new java::util::Hashtable();
$h->put('x','x');
}
===========================================================
Why?
I commented your definition of $SIG{__DIE__} out (sorry!) and after this
memory leak was away - used mem.size stays constant.
What side effects may have this modification? Is it dangerous?
Problem 2. Processing of subclasses of Number (Eg. java.lang.Long):
Code:
=====================================
use strict;
use Inline( JAVA => 'STUDY',
STUDY => [ 'java.lang.Long'],
);
my java::lang::Long $l = new java::lang::Long(123);
print $l->toString();
=====================================
... throws Exception:
Exception in thread "main" java.lang.NumberFormatException: java.lang.Long
at java.lang.Integer.parseInt(Integer.java:414)
at java.lang.Integer.parseInt(Integer.java:463)
at
InlineJavaServer$InlineJavaProtocol.CallJavaMethod(InlineJavaServer.java:858)
at
InlineJavaServer$InlineJavaProtocol.Do(InlineJavaServer.java:701)
at InlineJavaServer.ProcessCommand(InlineJavaServer.java:62)
at InlineJavaServer.<init>(InlineJavaServer.java:43)
at InlineJavaServer.main(InlineJavaServer.java:115)
Can't receive packet from JVM: at
/home/maria/perl/lib/perl5/site_perl/5.6.0/Inline/Java/Protocol.pm line
251
at a.pl line 9
Problem 3.
I don't understand really the meaning of AUTOSTUDY:
This 2 trials don't work: (error "Can't locate object method "new" via
package "java::util::Hashtable" at c.pl line 6, <DATA> line 601.")
==============================
# try 1
use strict;
use Inline( JAVA => 'STUDY',
AUTOSTUDY => 1,
);
my $h=new java::util::Hashtable();
==============================
#try 2
use Inline (
Java => 'DATA',
AUTOSTUDY => 1
) ;
my $obj = new java::util::Hashtable();
__END__
__Java__
import java.util.*;
=================================
What do I do wrong?
Problem 4: PERFORMANCE
I compared performance of code below
======================================
use Inline( JAVA => 'STUDY',
STUDY => ['java.util.Hashtable'],
);
my java::util::Hashtable $h;
while (1){
$h=new java::util::Hashtable();
$h->put('x','x');
}
======================================
and of the code, directly processed in java
Java was 3800 times quicker (!!!)
What do you think about this?
If there are ways to increase the performance? (Eg. caching of
Method-objects/Class-objects etc?)
Thank you!
Regargs
Masha
_____________________________________________
Maria Ananieva Software-Entwicklung
uni-X Software AG
Mindener Strasse 127 49084 Osnabrueck
Tel. +49-541- 71008-433 Fax +49-541-71008-99
http://www.uni-X.com [EMAIL PROTECTED]