This file is indexed.

/usr/lib/perl5/Inline/Java/Server.pm is in libinline-java-perl 0.53-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
package Inline::Java::Server ;
@Inline::Java::Server::ISA = qw(Exporter) ;

# Export the cast function if wanted
@EXPORT_OK = qw(start stop status) ;


use strict ;
use Exporter ;
use Carp ;
require Inline ;
require Inline::Java ;
use File::Spec ;


$Inline::Java::Server::VERSION = '0.53' ;


# Create a dummy Inline::Java object in order to 
# get the default options.
my $IJ = bless({}, "Inline::Java") ;
$IJ->validate(
	SHARED_JVM => 1
) ;



sub import {
	my $class = shift ;
	my $a = shift ;

	my @actions = () ;
	if ($a eq 'restart'){
		push @actions, 'stop', 'sleep', 'start' ;
	}
	else{
		push @actions, $a ;
	}

	my $host = $IJ->get_java_config("HOST") ;
	my $bind = $IJ->get_java_config("BIND") ;
	my $port = $IJ->get_java_config("PORT") ;
	foreach $a (@actions){
		if ($a eq 'sleep'){
			sleep(5) ;
			next ;
		}

		my $status = Inline::Java::Server::status() ;

		if ($a eq 'start'){
			if ($status){
				print "SHARED_JVM server on port $bind:$port is already running\n" ;
			}
			else{
				Inline::Java::Server::start() ;
				my $pid = Inline::Java::__get_JVM()->{pid} ;
				print "SHARED_JVM server on port $bind:$port started with pid $pid\n" ;
			}
		}
		elsif ($a eq 'stop'){
			if (! $status){
				print "SHARED_JVM server on port $host:$port is not running\n" ;
			}
			else {
				Inline::Java::Server::stop() ;
				print "SHARED_JVM server on port $host:$port stopped\n" ;
			}
		}
		elsif ($a eq 'status'){
			if ($status){
				print "SHARED_JVM on port $host:$port is running\n" ;
			}
			else {
				print "SHARED_JVM on port $host:$port is not running\n" ;
			}
		}
		else{
			croak("Usage: perl -MInline::Java::Server=(start|stop|restart|status)\n") ;
		}
	}

	exit() ;
}



sub status {
	my $socket = undef ;

	eval {
	    $socket = Inline::Java::JVM::setup_socket(
			$IJ->get_java_config("HOST"),
			$IJ->get_java_config("PORT"),
			0,
			1
	    ) ;
	} ;
	if ($@){
		return 0 ;
	}
	else {
		close($socket) ;
		return 1 ;
	}
}


sub start {
	my $dir = $ENV{PERL_INLINE_JAVA_DIRECTORY} ;

	Inline->bind(
		Java => 'STUDY',
		SHARED_JVM => 1,
		($dir ? (DIRECTORY => $dir) : ()),
	) ;
}


sub stop {
	# This will connect us to the running JVM
	Inline::Java::Server::start() ; 
	Inline::Java::capture_JVM() ; 
	Inline::Java::shutdown_JVM() ; 
}



1 ;