This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op/readdir.t (was Re: perl@14152)
[perl5.git] / jpl / Sample / Sample.jpl
CommitLineData
d50cb536
GS
1class Sample {
2 public static void main(String[] args) {
3 Sample sam = new Sample();
4 System.out.println(sam.foo("manny","moe","jack"));
5 System.out.println(sam.foo(1));
6 System.out.println(sam.foo(3.0));
7 sam.foo();
8 }
9
10 public static int thrice(int i) {
11 return i * 3;
12 }
13
14 perl void foo() {{
15 use POSIX;
16 print "TZ = ", POSIX::tzname(), "\n";
17 print "Got to ${self}->foo() method\n";
18 print "foo__I(2) = ", $self->foo__I__I(2),"\n";
19 print "thrice(123) = ", JPL::Sample->thrice__I__I(123), "\n";
20 print "thrice(12) = ", JPL::Sample->thrice__I__I(12), "\n";
21 print $self->foo__sss__s("MANNY", "MOE", "JACK"), "\n";
22 print 41 + $self->foo__sss__s("1", "2", "3"), "\n";
23 print "Perl version is $]\n";
24 }}
25
26 perl int foo(int a) {{
27 $a + $a;
28 }}
29
30 perl double foo(double a) {{
31 use JPL::Class 'java::util::Random';
32 $rng = java::util::Random->new();
33 print "RNG = $rng\n";
34 print $rng->nextDouble____D(), "\n";
35 print $rng->nextDouble____D(), "\n";
36 print $rng->nextDouble____D(), "\n";
37 print $rng->nextDouble____D(), "\n";
38 return $a * $a;
39 }}
40
41 perl String foo( String a,
42 String b,
43 String c ) {{
44 print "a = $a, b = $b, c = $c\n";
45 join "+", $a, $b, $c;
46 }}
47
48}