[libinline-java-perl] 94/398: Adapted 0.40

Jonas Smedegaard dr at jones.dk
Thu Feb 26 11:42:53 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 60e9c389bcb5f6ed8b9faac0e688555fd58c7a50
Author: Patrick LeBoutillier <patl at cpan.org>
Date:   Fri Jun 1 13:56:13 2001 +0000

    Adapted 0.40
---
 Java/JVM.pm    | 23 ++++++++++++++++-------
 Java/Object.pm | 10 +++++-----
 2 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/Java/JVM.pm b/Java/JVM.pm
index aacc0e6..697f104 100644
--- a/Java/JVM.pm
+++ b/Java/JVM.pm
@@ -7,7 +7,7 @@ $Inline::Java::JVM::VERSION = '0.20' ;
 
 use Carp ;
 use IPC::Open3 ;
-
+use IO::File ;
 
 sub new {
 	my $class = shift ;
@@ -21,7 +21,7 @@ sub new {
 
 	Inline::Java::debug("Starting JVM...") ;
 
-	if ($o->{Java}->{JNI}){
+	if ($o->get_java_config('JNI')){
 		Inline::Java::debug("  JNI mode") ;
 
 		require Inline::Java::JNI ;
@@ -39,20 +39,20 @@ sub new {
 
 		my $debug = (Inline::Java::get_DEBUG() ? "true" : "false") ;
 
-		my $port = $o->{Java}->{PORT} ;
-		my $java = $o->{Java}->{BIN} . "/java" . Inline::Java::portable("EXE_EXTENSION") ;
+		my $port = $o->get_java_config('PORT') ;
+		my $java = $o->get_java_config('BIN') . "/java" . Inline::Java::portable("EXE_EXTENSION") ;
 		my $pjava = Inline::Java::portable("RE_FILE", $java) ;
 
 		my $cmd = "\"$pjava\" InlineJavaServer $debug $port" ;
 		Inline::Java::debug($cmd) ;
 
-		if ($o->{config}->{UNTAINT}){
+		if ($o->get_config('UNTAINT')){
 			($cmd) = $cmd =~ /(.*)/ ;
 		}
 
 		my $pid = 0 ;
 		eval {
-			my $in = '' ;
+			my $in = new IO::File() ;
 			$pid = open3($in, ">&STDOUT", ">&STDERR", $cmd) ;
 			# We won't be sending anything to the child in this fashion...
 			close($in) ;
@@ -60,7 +60,10 @@ sub new {
 		croak "Can't exec JVM: $@" if $@ ;
 
 		$this->{pid} = $pid ;
-		$this->{socket}	= $this->setup_socket($port, $o->{Java}->{STARTUP_DELAY}) ;
+		$this->{socket}	= $this->setup_socket(
+			$port, 
+			$o->get_java_config('STARTUP_DELAY')
+		) ;
 	}
 
 	return $this ;
@@ -114,6 +117,12 @@ sub setup_socket {
 			alarm($timeout) ;
 		}
 
+		# ignore expected "connection refused" warnings
+		# Thanks binkley!
+		local $SIG{__WARN__} = sub { 
+			warn($@) unless ($@ =~ /Connection refused/i) ; 
+		} ;
+
 		while (1){
 			$socket = new IO::Socket::INET(
 				PeerAddr => 'localhost',
diff --git a/Java/Object.pm b/Java/Object.pm
index 4eff993..95bc9df 100644
--- a/Java/Object.pm
+++ b/Java/Object.pm
@@ -3,7 +3,7 @@ package Inline::Java::Object ;
 
 use strict ;
 
-$Inline::Java::Object::VERSION = '0.20' ;
+$Inline::Java::Object::VERSION = '0.22' ;
 
 use Inline::Java::Protocol ;
 use Carp ;
@@ -37,7 +37,7 @@ sub __new {
 	my $knot = tie %this, $class ;
 	my $this = bless(\%this, $class) ;
 
-	my $pkg = $inline->{pkg} ;
+	my $pkg = $inline->get_api('pkg') ;
 	if ($class ne "Inline::Java::Object"){
 		$class = Inline::Java::java2perl($pkg, $java_class) ;
 	}
@@ -100,7 +100,7 @@ sub __validate_prototype {
 		Inline::Java::debug("Matching arguments to $method$s") ;
 		
 		eval {
-			($new_args, $score) = Inline::Java::Class::CastArguments($args, $proto, $inline->{modfname}) ;
+			($new_args, $score) = Inline::Java::Class::CastArguments($args, $proto, $inline->get_api('modfname')) ;
 		} ;
 		if ($@){
 			if ($nb_proto == 1){
@@ -172,7 +172,7 @@ sub __validate_prototype {
 
 	# Here we will be polite and warn the user if we had to choose a 
 	# method by ourselves.
-	if ($inline->{Java}->{WARN_METHOD_SELECT}){
+	if ($inline->get_java_config('WARN_METHOD_SELECT')){
 		if (($nb_matched > 1)&&
 			($chosen->{SCORE} < ($chosen->{NB_ARGS} * 10))){
 			my $msg = "Based on the arguments passed, I had to choose between " .
@@ -471,7 +471,7 @@ sub new {
 	my $this = {} ;
 	$this->{class} = $obj_class ;
 	$this->{java_class} = $java_class ;
-	$this->{module} = $inline->{modfname} ;
+	$this->{module} = $inline->get_api('modfname') ;
 	$this->{proto} = new Inline::Java::Protocol($this, $inline) ;
 
 	bless($this, $class) ;

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