[libinline-java-perl] 221/398: ok

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:43:05 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 9e6880d44ad539eca68ebfb48888be00a9b1a7b3
Author: patrick_leb <>
Date:   Thu Apr 10 17:52:44 2003 +0000

    ok
---
 Java.pm          |  8 +++++++-
 Java/JVM.pm      | 30 ++++++++++++++++++------------
 Java/Portable.pm | 11 +++++------
 README           | 18 ++++++++++--------
 4 files changed, 40 insertions(+), 27 deletions(-)

diff --git a/Java.pm b/Java.pm
index c20b0b7..8bcf454 100644
--- a/Java.pm
+++ b/Java.pm
@@ -448,7 +448,13 @@ sub _study {
 
 	if ($study_module){
 		# We need to add the classes that are in the directory or under...
-		my @fl = Inline::Java::Portable::find_classes_in_dir($install_dir) ;
+		my $cwd = Cwd::cwd() ;
+		if ($o->get_config('UNTAINT')){
+			($cwd) = $cwd =~ /(.*)/ ;
+		}
+		chdir($install_dir) ;
+		my @fl = Inline::Java::Portable::find_classes_in_dir('.') ;
+		chdir $cwd ;
 		foreach my $f (@fl){
 			push @{$classes}, $f->{class} ;
 		}
diff --git a/Java/JVM.pm b/Java/JVM.pm
index 4e2cf84..b22cbf5 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -61,22 +61,28 @@ sub new {
 		$this->{host} = "localhost" ;
 
 		# Grab the next free port number and release it.
-		if ($this->{port} < 0){
-			my $sock = IO::Socket::INET->new(
-				Listen => 0, Proto => 'tcp',
-				LocalAddr => 'localhost', LocalPort => 0) ;
-			if ($sock){
-				$this->{port} = $sock->sockport() ;
-				Inline::Java::debug(2, "next available port number is $this->{port}") ;
-				close($sock) ;
+		if ((! $this->{shared})&&($this->{port} < 0)){
+			if (Inline::Java::portable("GOT_NEXT_FREE_PORT")){
+				my $sock = IO::Socket::INET->new(
+					Listen => 0, Proto => 'tcp',
+					LocalAddr => 'localhost', LocalPort => 0) ;
+				if ($sock){
+					$this->{port} = $sock->sockport() ;
+					Inline::Java::debug(2, "next available port number is $this->{port}") ;
+					close($sock) ;
+				}
+				else{
+					# Revert to the default.
+					$this->{port} = - $this->{port} ;
+					carp(
+						"Could not get next available port number, using port " .
+						"$this->{port} instead. Use the PORT configuration " .
+						"option to suppress this warning.\n Error: $!\n") ;
+				}
 			}
 			else{
 				# Revert to the default.
 				$this->{port} = - $this->{port} ;
-				carp(
-					"Could not get next available port number, using port " .
-					"$this->{port} instead. Use the PORT configuration " .
-					"option to suppress this warning.\n") ;
 			}
 		}
 
diff --git a/Java/Portable.pm b/Java/Portable.pm
index 6065759..e7fe654 100644
--- a/Java/Portable.pm
+++ b/Java/Portable.pm
@@ -99,18 +99,15 @@ sub get_user_jar {
 sub find_classes_in_dir {
 	my $dir = shift ;
 
-	my $sdir = (File::Spec->splitpath(
-		File::Spec->catfile($dir, 'dummy_file')))[1] ;
-
 	my @ret = () ;
 	find(sub {
 		my $f = $_ ;
 		if ($f =~ /\.class$/){
 			my $file = $File::Find::name ;
-			my $fdir = (File::Spec->splitpath($file))[1] ;
-			$fdir =~ s/^$sdir// ;
-
+			my $fdir = $File::Find::dir ;
 			my @dirs = File::Spec->splitdir($fdir) ;
+			# Remove '.'
+			shift @dirs ; 
 			if ((! scalar(@dirs))||($dirs[-1] ne '')){
 				push @dirs, '' ;
 			}
@@ -133,6 +130,7 @@ sub portable {
 		EXE_EXTENSION		=>	$Config{exe_ext},
 		GOT_ALARM			=>  $Config{d_alarm} || 0,
 		GOT_FORK			=>	$Config{d_fork} || 0,
+		GOT_NEXT_FREE_PORT	=>	1,
 		ENV_VAR_PATH_SEP	=>	$Config{path_sep},
 		SO_EXT				=>	$Config{dlext},
 		PREFIX				=>	$Config{prefix},
@@ -161,6 +159,7 @@ sub portable {
 			DETACH_OK			=>	0,
 			JVM_LIB				=>	'jvm.lib',
 			JVM_SO				=>	'jvm.dll',
+			GOT_NEXT_FREE_PORT	=>	($COMMAND_COM ? 0 : 1),
 		},
 		cygwin => {
 			ENV_VAR_PATH_SEP_CP	=>	';',
diff --git a/README b/README
index ea1c542..722d54f 100644
--- a/README
+++ b/README
@@ -41,22 +41,24 @@ INSTALLATION:
 
 To install Inline::Java do this:
 
-perl Makefile.PL
-make                     (see Note 1)
-make java
-make test                (see Note 2, 3)
-make install
+  % perl Makefile.PL         (see Note 1)
+  % make java                (see Note 2)
+  % make
+  % make test                (see Note 3, 4)
+  % make install
 
 You have to 'make install' before you can run it successfully. 
 
+Note 1: Under Win95/98/Me, you may need to do 'cd ..' to get back to the
+your original directory after the command has completed.
 
-Note 1: Use nmake on Windows systems.
+Note 2: Use nmake on Win32.
 
-Note 2: If you have built the JNI extension and want the test suite to use 
+Note 3: If you have built the JNI extension and want the test suite to use 
 it, you will need to set the PERL_INLINE_JAVA_JNI environment variable to 1 
 BEFORE running 'make test'.
 
-Note 3: When testing Inline::Java, it's always a good idea to run 'make test'
+Note 4: When testing Inline::Java, it's always a good idea to run 'make test'
 twice. The first time you test the building and loading of a module, the 
 second time you test loading of an already built module.
 

-- 
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