[libinline-java-perl] 116/398: *** empty log message ***
Jonas Smedegaard
dr at jones.dk
Thu Feb 26 11:42:55 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 5ff99e9a10a2922a89c7bf6f661e8504c0c80154
Author: Patrick LeBoutillier <patl at cpan.org>
Date: Thu Dec 6 18:10:28 2001 +0000
*** empty log message ***
---
Java.pm | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 80 insertions(+), 2 deletions(-)
diff --git a/Java.pm b/Java.pm
index 92927cb..6d69aaa 100644
--- a/Java.pm
+++ b/Java.pm
@@ -2,12 +2,12 @@ package Inline::Java ;
@Inline::Java::ISA = qw(Inline Exporter) ;
# Export the cast function if wanted
- at EXPORT_OK = qw(cast study_classes) ;
+ at EXPORT_OK = qw(cast study_classes caught) ;
use strict ;
-$Inline::Java::VERSION = '0.30' ;
+$Inline::Java::VERSION = '0.31' ;
# DEBUG is set via the DEBUG config
@@ -51,6 +51,10 @@ my $JVM = undef ;
my $INLINES = {} ;
+# Stores the last uncaught exception
+my $UNCAUGHT_EXCEPTION = undef ;
+
+
# Here is some code to figure out if we are running on command.com
# shell under Windows.
my $COMMAND_COM =
@@ -198,6 +202,9 @@ sub _validate {
}
$o->{ILSM}->{$key} = $value ;
}
+ elsif ($key eq 'REMOTE_HOST'){
+ $o->{ILSM}->{$key} = $value ;
+ }
elsif ($key eq 'SHARED_JVM'){
$o->{ILSM}->{$key} = $value ;
}
@@ -238,6 +245,12 @@ sub _validate {
if (($o->{ILSM}->{JNI})&&($o->{ILSM}->{SHARED_JVM})){
croak("You can't use the 'SHARED_JVM' option in 'JNI' mode") ;
}
+ if (($o->{ILSM}->{JNI})&&($o->{ILSM}->{REMOTE_HOST})){
+ croak("You can't use the 'REMOTE_HOST' option in 'JNI' mode") ;
+ }
+ if (($o->{ILSM}->{REMOTE_HOST})&&($o->{ILSM}->{SHARED_JVM})){
+ croak("You can't use the 'REMOTE_HOST' option in combination with the 'SHARED_JVM' option") ;
+ }
$o->set_java_bin() ;
@@ -1345,6 +1358,71 @@ sub study_classes {
}
+sub try (&){
+ my $coderef = shift ;
+ eval {
+ $coderef->() ;
+ } ;
+ my $e = $@ ;
+ if ($e){
+ if (! UNIVERSAL::isa($e, "Inline::Java::Object")){
+ die $e ;
+ }
+
+ $UNCAUGHT_EXCEPTION = $@ ;
+ $@ = undef ;
+ }
+}
+
+
+sub catch ($$){
+ my $class = shift ;
+ my $coderef = shift ;
+
+ $class = Inline::Java::Class::ValidateClass($class) ;
+
+ my $e = $UNCAUGHT_EXCEPTION ;
+ if ($e){
+ if (UNIVERSAL::isa($e, "Inline::Java::Object")){
+ my ($msg, $score) = $e->__isa($class) ;
+ if ($msg){
+ croak $msg ;
+ }
+ $coderef->($e) ;
+ # clear $@ for other blocks that follow
+ $UNCAUGHT_EXCEPTION = undef ;
+ }
+ }
+}
+
+
+sub caught {
+ my $class = shift ;
+
+ my $e = $@ ;
+
+ $class = Inline::Java::Class::ValidateClass($class) ;
+
+ my $ret = 0 ;
+ if (($e)&&(UNIVERSAL::isa($e, "Inline::Java::Object"))){
+ my ($msg, $score) = $e->__isa($class) ;
+ if ($msg){
+ croak $msg ;
+ }
+ $ret = 1 ;
+ }
+ $@ = $e ;
+
+ return $ret ;
+}
+
+
+sub with (&){
+ my $coderef = shift ;
+
+ return $coderef ;
+}
+
1 ;
--
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