[libinline-java-perl] 230/398: ok
Jonas Smedegaard
dr at jones.dk
Thu Feb 26 11:43:07 UTC 2015
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.55
in repository libinline-java-perl.
commit 197bebb71db0e2eea84e2255960a92dd7f54669f
Author: patrick_leb <>
Date: Tue Apr 22 20:51:48 2003 +0000
ok
---
CHANGES | 3 ++-
Java.pm | 29 +++++++++++++++++++---------
Java/JVM.pm | 2 +-
Java/Makefile.PL | 30 ++++++++++++++++++----------
Java/Object.pm | 59 +++++++++++++++++++++++++-------------------------------
Java/Portable.pm | 12 ++++++++++++
README | 11 ++++++-----
TODO | 3 ++-
8 files changed, 89 insertions(+), 60 deletions(-)
diff --git a/CHANGES b/CHANGES
index c016d6b..a422f31 100644
--- a/CHANGES
+++ b/CHANGES
@@ -15,7 +15,8 @@ Revision history for Perl extension Inline::Java
clashes.
Note: The default port on systems where this feature is not
available has remained 7890.
- Note: The default port for SHARED_JVM mode it has remained 7890.
+ Note: The default port for SHARED_JVM mode is now 7891.
+ - SHARED_JVM mode now calls release_JVM() automatically.
- User code can now be a public class and (optionally) inside a package.
- Callback classes have changed.
Note: These classes are now in the org.perl.inline.java package.
diff --git a/Java.pm b/Java.pm
index f13061a..53a91ac 100644
--- a/Java.pm
+++ b/Java.pm
@@ -35,7 +35,7 @@ use Inline::Java::Callback ;
# Must be last.
use Inline::Java::JVM ;
# Our default J2SK
-require File::Spec->catfile('Java', 'default_j2sdk.pl') ;
+require Inline::Java->find_default_j2sdk() ;
# This is set when the script is over.
@@ -139,7 +139,7 @@ sub validate {
if ($o->get_java_config('PORT') == -1){
if ($o->get_java_config('SHARED_JVM')){
- $o->set_java_config('PORT', 7890) ;
+ $o->set_java_config('PORT', 7891) ;
}
else{
$o->set_java_config('PORT', -7890) ;
@@ -305,7 +305,7 @@ sub build {
my $cp = $ENV{CLASSPATH} || '' ;
$ENV{CLASSPATH} = make_classpath($o->get_java_config('CLASSPATH'), $server_jar, @prev_install_dirs) ;
Inline::Java::debug(2, "classpath: $ENV{CLASSPATH}") ;
- my $cmd = "\"$javac\" -d \"$install_dir\" $source > cmd.out $redir" ;
+ my $cmd = portable("SUB_FIX_CMD_QUOTES", "\"$javac\" -d \"$install_dir\" $source > cmd.out $redir") ;
if ($o->get_config('UNTAINT')){
($cmd) = $cmd =~ /(.*)/ ;
}
@@ -413,7 +413,7 @@ sub load {
my $st = $pc->ServerType() ;
if ((($st eq "shared")&&(! $o->get_java_config('SHARED_JVM')))||
(($st eq "private")&&($o->get_java_config('SHARED_JVM')))){
- croak "JVM type mismatch on port " . $o->get_java_config('PORT') ;
+ croak "JVM type mismatch on port " . $JVM->{port} ;
}
}
else{
@@ -424,6 +424,8 @@ sub load {
# Add our Inline object to the list.
push @INLINES, $o ;
+ $o->set_java_config('id', scalar(@INLINES) - 1) ;
+ Inline::Java::debug(3, "Inline::Java object id is " . $o->get_java_config('id')) ;
my $classes = [] ;
if ((defined($o->get_java_config('STUDY')))&&(scalar($o->get_java_config('STUDY')))){
@@ -631,7 +633,7 @@ sub bind_jdat {
return ;
}
- my $inline_idx = scalar(@INLINES) - 1 ;
+ my $inline_idx = $o->get_java_config('id') ;
my %classes = %{$d->{classes}} ;
foreach my $class (sort keys %classes) {
@@ -713,6 +715,10 @@ CODE
# open (Inline::Java::CODE, ">>code") and print CODE $code and close(CODE) ;
+ # Here it seems that for the eval below to resolve the @INLINES
+ # list properly, it must be used in this function...
+ my $dummy = scalar(@INLINES) ;
+
eval $code ;
croak $@ if $@ ;
@@ -727,8 +733,6 @@ sub bind_method {
my $method = shift ;
my $static = shift ;
- my $inline_idx = scalar(@INLINES) - 1 ;
-
my $code = <<CODE;
sub $method {
@@ -924,11 +928,11 @@ sub known_to_perl {
no strict 'refs' ;
if (defined(${$perl_class . "::" . "EXISTS"})){
- Inline::Java::debug(3, "perl knows about '$jclass'") ;
+ Inline::Java::debug(3, "perl knows about '$jclass' ('$perl_class')") ;
return 1 ;
}
else{
- Inline::Java::debug(3, "perl doesn't know about '$jclass'") ;
+ Inline::Java::debug(3, "perl doesn't know about '$jclass' ('$perl_class')") ;
}
return 0 ;
@@ -1022,4 +1026,11 @@ sub caught {
}
+sub find_default_j2sdk {
+ my $class = shift ;
+
+ return File::Spec->catfile('Inline', 'Java', 'default_j2sdk.pl') ;
+}
+
+
1 ;
diff --git a/Java/JVM.pm b/Java/JVM.pm
index b22cbf5..ab37af6 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -101,7 +101,7 @@ sub new {
"java" . Inline::Java::portable("EXE_EXTENSION")) ;
my $shared = ($this->{shared} ? "true" : "false") ;
- my $cmd = "\"$java\" org.perl.inline.java.InlineJavaServer $debug $this->{port} $shared" ;
+ my $cmd = Inline::Java::portable("SUB_FIX_CMD_QUOTES", "\"$java\" org.perl.inline.java.InlineJavaServer $debug $this->{port} $shared") ;
Inline::Java::debug(2, $cmd) ;
if ($o->get_config('UNTAINT')){
($cmd) = $cmd =~ /(.*)/ ;
diff --git a/Java/Makefile.PL b/Java/Makefile.PL
index a8380ac..c8ac8d8 100644
--- a/Java/Makefile.PL
+++ b/Java/Makefile.PL
@@ -19,7 +19,6 @@ my $jvm_so = Inline::Java::Portable::portable('JVM_SO') ;
my %so_dirs = () ;
my @files = (
- 'jvm.cfg',
'jni.h',
'jni_md.h',
$jvm_lib,
@@ -27,6 +26,7 @@ my @files = (
if ($jvm_so ne $jvm_lib){
push @files, $jvm_so ;
}
+push @files, 'jvm.cfg' ;
my $files = {
'jni.h' => {
@@ -65,16 +65,18 @@ if (($build_jni || AskYN("Do you wish to build the JNI extension?", 'y'))){
find(\&search, $jdk_dir) ;
my $type = FindDefaultVMType() ;
- my $cnt = 1 ;
- foreach my $c (@{$files->{$jvm_lib}->{choices}}){
- if ($c =~ /$type/){
- $files->{$jvm_lib}->{default_choice} = $cnt ;
+ if (defined($type)){
+ my $cnt = 1 ;
+ foreach my $c (@{$files->{$jvm_so}->{choices}}){
+ if ($c =~ /$type/){
+ $files->{$jvm_so}->{default_choice} = $cnt ;
+ }
+ $cnt++ ;
}
- $cnt++ ;
}
# We no longer need jvm.cfg from now on...
- shift @files ;
+ pop @files ;
my $done = 0 ;
foreach my $f (@files){
@@ -109,12 +111,20 @@ if (($build_jni || AskYN("Do you wish to build the JNI extension?", 'y'))){
map {print " $_\n"; } keys %so_dirs ;
print "See README.JNI for more information.\n\n" ;
+ my @I = (
+ Inline::Java::Portable::portable('SUB_FIX_MAKE_QUOTES',
+ "-I" . $files->{'jni.h'}->{selected}),
+ Inline::Java::Portable::portable('SUB_FIX_MAKE_QUOTES',
+ "-I" . $files->{'jni_md.h'}->{selected})) ;
+ my @L = (
+ Inline::Java::Portable::portable('SUB_FIX_MAKE_QUOTES',
+ "-L" . $files->{$jvm_lib}->{selected})) ;
WriteMakefile(
NAME => 'Inline::Java::JNI',
VERSION_FROM => 'JNI.pm',
DIR => [],
- INC => "-I" . $files->{'jni.h'}->{selected} . " -I" . $files->{'jni_md.h'}->{selected},
- LIBS => ["-L" . $files->{$jvm_lib}->{selected} . " -ljvm"],
+ INC => join(' ', @I),
+ LIBS => [join(' ', @L) . " -ljvm"],
# CCFLAGS => '-D_REENTRANT',
) ;
}
@@ -197,7 +207,7 @@ sub FindDefaultVMType {
next ;
}
else{
- $type = split(/\s+/, $line) ;
+ ($type) = split(/\s+/, $line) ;
$type =~ s/^-// ;
last ;
}
diff --git a/Java/Object.pm b/Java/Object.pm
index 6f6c9e9..5259dc0 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -333,43 +333,36 @@ sub DESTROY {
my $class = $this->__get_private()->{class} ;
Inline::Java::debug(2, "destroying object in java ($class):") ;
- # I can't find any other trace of this weak_ref stuff, but
- # it's not a bad idea...
- if (! $this->__get_private()->{weak_ref}){
- # This one is very tricky:
- # Here we want to be careful since this can be called
- # at scope end, but the scope end might be triggered
- # by another croak, so we need to record and propagate
- # the current $@
- my $prev_dollar_at = $@ ;
- eval {
- $this->__get_private()->{proto}->DeleteJavaObject($this) ;
- } ;
- if ($@){
- # We croaked here. Was there already a pending $@?
- my $name = $this->__get_private()->{class} ;
- my $msg = "In method DESTROY of class $name: $@" ;
- if ($prev_dollar_at){
- $msg = "$prev_dollar_at\n$msg" ;
- }
- croak $msg ;
+ # This one is very tricky:
+ # Here we want to be careful since this can be called
+ # at scope end, but the scope end might be triggered
+ # by another croak, so we need to record and propagate
+ # the current $@
+ my $prev_dollar_at = $@ ;
+ eval {
+ $this->__get_private()->{proto}->DeleteJavaObject($this) ;
+ } ;
+ if ($@){
+ # We croaked here. Was there already a pending $@?
+ my $name = $this->__get_private()->{class} ;
+ my $msg = "In method DESTROY of class $name: $@" ;
+ if ($prev_dollar_at){
+ $msg = "$prev_dollar_at\n$msg" ;
}
- else{
- # Put back the previous $@
- $@ = $prev_dollar_at ;
- }
-
- # Here we have a circular reference so we need to break it
- # so that the memory is collected.
- my $priv = $this->__get_private() ;
- my $proto = $priv->{proto} ;
- $priv->{proto} = undef ;
- $proto->{obj_priv} = undef ;
- $PRIVATES->{$this} = undef ;
+ croak $msg ;
}
else{
- Inline::Java::debug(4, "object marked as weak reference, object destruction not propagated to Java") ;
+ # Put back the previous $@
+ $@ = $prev_dollar_at ;
}
+
+ # Here we have a circular reference so we need to break it
+ # so that the memory is collected.
+ my $priv = $this->__get_private() ;
+ my $proto = $priv->{proto} ;
+ $priv->{proto} = undef ;
+ $proto->{obj_priv} = undef ;
+ $PRIVATES->{$this} = undef ;
}
else{
Inline::Java::debug(4, "script marked as DONE, object destruction not propagated to Java") ;
diff --git a/Java/Portable.pm b/Java/Portable.pm
index 2823fcd..bf997ac 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -144,6 +144,8 @@ sub portable {
DEV_NULL => '/dev/null',
COMMAND_COM => 0,
SUB_FIX_CLASSPATH => undef,
+ SUB_FIX_CMD_QUOTES => undef,
+ SUB_FIX_MAKE_QUOTES => undef,
JVM_LIB => 'libjvm.so',
JVM_SO => 'libjvm.so',
} ;
@@ -161,6 +163,16 @@ sub portable {
JVM_LIB => 'jvm.lib',
JVM_SO => 'jvm.dll',
GOT_NEXT_FREE_PORT => 0,
+ SUB_FIX_CMD_QUOTES => ($COMMAND_COM ? undef : sub {
+ my $val = shift ;
+ $val = qq{"$val"} ;
+ return $val ;
+ }),
+ SUB_FIX_MAKE_QUOTES => sub {
+ my $val = shift ;
+ $val = qq{"$val"} ;
+ return $val ;
+ },
},
cygwin => {
ENV_VAR_PATH_SEP_CP => ';',
diff --git a/README b/README
index 88b9e6d..e19c073 100644
--- a/README
+++ b/README
@@ -33,7 +33,7 @@ See README.JNI for more information on building the JNI extension.
-------------------------------------------------------------------------------
INSTALLATION:
-- This module requires Inline version 0.43 or higher to be installed.
+- This module requires Inline version 0.44 or higher to be installed.
- It also requires a version of the Java SDK 1.2 or higher to be
installed. You can get the latest Java SDK from Sun Microsystems
at http://java.sun.com. Follow the provided instructions in order
@@ -41,10 +41,10 @@ INSTALLATION:
To install Inline::Java do this:
- % perl Makefile.PL (see Note 1)
- % make java (see Note 2)
+ % perl Makefile.PL J2SDK=/your/java/dir (see Note 1)
+ % make java (see Note 2)
% make
- % make test (see Note 3, 4)
+ % make test (see Note 3, 4)
% make install
You have to 'make install' before you can run it successfully.
@@ -84,7 +84,8 @@ Inline::Java version 0.40 is a major upgrade that includes:
clashes.
Note: The default port on systems where this feature is not
available has remained 7890.
- Note: The default port for SHARED_JVM mode it has remained 7890.
+ Note: The default port for SHARED_JVM mode is now 7891.
++ SHARED_JVM mode now calls release_JVM() automatically.
+ User code can now be a public class and (optionally) inside a package.
+ Callback classes have changed.
Note: These classes are now in the org.perl.inline.java package.
diff --git a/TODO b/TODO
index 1af7982..3ce0de4 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,10 @@
CODE:
+- Check John's bug #5. It seems if two modules have the same
+ module name some stuff gets screwed up.
TEST:
- Alpha
- Cygwin
-- J2SDK 1.4.0 under Windows
DOCUMENTATION:
- Recheck all and complete.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libinline-java-perl.git
More information about the Pkg-perl-cvs-commits
mailing list