-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
88 lines (65 loc) · 2.36 KB
/
README
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
NAME
Inline::JSX - write Perl program in JSX
SYNOPSIS
use Inline 'JSX';
print Addition->add(1, 2), "\n"; # => 3
print Addition->add('foo', 'bar'), "\n"; # => foobar
print Addition->add('foo', 2), "\n"; # => error: type mismatch!
__END__
__JSX__
class Addition {
static function add(x:int, y:int) : int {
return x + y;
}
static function add(x:string, y:string) : string {
return x + y;
}
}
DESCRIPTION
Inline::JSX allows you to write JSX code in your Perl source code.
OPTIONS
JSX_PATH
Path to "jsx" command. You can set it with the environmental variable
"PERL_INLINE_JSX_JSX_PATH" too.
LIB_PATH
Path to jsx libray directory. You can set it with the environmental
variable "PERL_INLINE_JSX_LIB_PATH" too.
CLASS_PREFIX
Prefix name of classes in Perl code.
use Inline JSX => 'DATA', CLASS_PREFIX => 'JSX::';
my $foo = JSX::Foo->new;
__DATA__
__JSX__
class Foo {}
CONSOLE_SDOUT
Inline::JSX provides JSX's 'log' function that prints a dumped data to
"STDOUT". You can use this option with a file path or a file handle to
print out to other file handle.
use Inline JSX => Config => CONSOLE_STDOUT => $file_path;
You can set it with the environmental variables
"PERL_INLINE_JSX_CONSOLE_STDOUT" too.
MAPPING
JSX => Perl
undefined undef
null undef
int, number number
string string
boolean 1 / !1 (true/false)
Object hash ref
Array array ref
Function JE::Object::Function
new Class blessed object
RegExp Regexp
Date Time::Piece
NOTE
JS's "null" is converted to "undef" in Perl while this module supports
"Inline::JSX::null()" to pass "null" to Perl-JSX function.
JS's Date object is converted to Time::Piece.
SEE ALSO
Inline, JE, <http://jsx.github.com/>
AUTHOR
Makamaka Hannyaharamitu, <makamaka[at]cpan.org>
COPYRIGHT AND LICENSE
Copyright 2012 by Makamaka Hannyaharamitu
This library is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.