public class AboutMe {
public static void main(String[] args) {
System.out.println("Java Developer and Trainer");
}
}
#!/usr/bin/env perl
print 'I used to be a Perl Dev.', "\n";
!expert
maybe there is something you can do faster in java?
maybe you have something in java you don't want to rewrite?
you say po-tay-toe, i say po-tah-toe
== Installing modules for JVM
cd modules/panda && sh -c "PATH=/home/ghost/rakudo-star-2016.07/install/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin /home/ghost/rakudo-star-2016.07/install/bin/perl6-j bootstrap.pl"
^@==> Bootstrapping Panda
^@^@^@Cannot unbox a type object
perl Configure.pl --backends=moar,jvm --gen-moar
Please note that this release of Rakudo Star is not fully functional with the
JVM backend from the Rakudo compiler. Please use the MoarVM backend only.
#perl6 confirms jvm backend !works since at least the GLR in December-ish
requires J7, no panda, no zef
install/bin/nqp-j:exec java -Xss1m -Xmx512m
java
from
perl 5
from
perl 6
??!!
Warning: Cannot install Inline::Java, don't know what it is.
The PerlInterpreter extension allows Inline::Java to be loaded directly from
Java using an embedded Perl interpreter. It is still EXPERIMENTAL and
may not build or work properly on all platforms. See documentation for
more details.
Do you wish to build the PerlInterpreter extension? [n] n
__DATA__ ok ...
-Duseshrplib
-Dusemultiplicity
-fPIC
#!/usr/bin/env perl6
use Inline::Perl5;
my $p5 = Inline::Perl5.new;
$p5.run(q|
use Inline Java => <<'END_OF_JAVA_CODE' ;
class Pod_alu {
public Pod_alu(){ }
public int add(int i, int j){ return i + j ; }
public int subtract(int i, int j){ return i - j ; }
}
END_OF_JAVA_CODE
my $alu = new Pod_alu() ;
print($alu->add(9, 16) . "\n") ; # prints 25
print($alu->subtract(9, 16) . "\n") ; # prints -7
|);
#!/usr/bin/env perl
use strict;
use warnings;
use Inline Java => 'DATA';
my $java = new Hello();
$java->printSomething("Hello Bradley!");
__DATA__
__Java__
public class Hello {
public void printSomething(final String something) {
System.out.println(something);
}
}
java from perl 5 ... the ducken
perl 5 from perl 6 ... the turduck
#!/usr/bin/env perl6
use Inline::Perl5;
my $p5 = Inline::Perl5.new;
$p5.run(q|
package Person;
use Moose;
has 'name' => (is => 'rw');
1;
|);
$p5.use('Person');
EVAL q|
my $person = Person->new(name => 'Bradley');
print 'Hello ', $person->name, "!\n";
|, :lang<Perl5>;
#!/usr/bin/env perl
use strict;
use warnings;
use Inline::Perl6;
my $p6 = Inline::Perl6->new;
$p6->run('
class Person {
has Stringy $.name;
}
say "Hello ", Person.new(name => "Bradley").name(), "!";
');
perl 6 from perl 5 ... the reverse turduck
perl 6 from java ... the reverse turen
perl 5 from java ... the reverse ducken
java from perl 6 ... the turen