inccode.com Perl- Java-. perl- - perl. perl , .
VarBox : ref (HASH), ref (ARRAY) BoxModule Perl-.
show perl script, "hello world". LibConsole script LibPrinter LibConsole.
use strict;
use test::LibPrinter;
use test::LibConsole;
hello_on_console( "hello world");
hello_on_printer( "hello world");
sub get_console
{
my $console = test::LibConsole->new();
return $console;
}
sub get_printer
{
my $printer = get_console()->get_printer();
return $printer;
}
sub hello_on_console
{
my ($hello) = @_;
my $console = get_console();
$console->output ($hello);
}
sub hello_on_printer
{
my ($hello) = @_;
my $printer= get_printer();
$printer->output ($hello);
}
, , perl , , "" . , , , (module = "{class}" ) .
, .
public class hello extends CRoutineProcess implements IInProcess
{
VarBox call ()
{
hello_on_console("hello world");
return hello_on_printer("hello world");
}
BoxModule<LibConsole> get_console ()
{
BoxModule<LibConsole> varConsole = new BoxModule<LibConsole>(LibConsole.apply());
return varConsole;
}
BoxModule<test.LibPrinter> get_printer ()
{
BoxModule<LibPrinter> varPrinter = new BoxModule<LibPrinter>(get_console().getModule().get_printer());
return varPrinter;
}
VarBox hello_on_console (VarBox varHello)
{
BoxModule<LibConsole> varConsole = new BoxModule<LibConsole>(get_console());
return varConsole.getModule().output(varHello);
}
VarBox hello_on_printer (VarBox varHello)
{
BoxModule<LibPrinter> varPrinter = new BoxModule<LibPrinter>(get_printer());
return varPrinter.getModule().output(varHello);
}
}
.
source
share