
HTML::ERuby - ERuby processor for Perl.

use HTML::ERuby; my $compiler = HTML::ERuby->new; my $result = $compiler->compile(filename => './foo.rhtml'); print $result;

HTML::ERuby is a ERuby processor written in Perl.
parse ERuby document by Perl and evaluate by Ruby.

constructs HTML::ERuby object.
compile ERuby document and return result. you can specify ERuby document as filename, scalarref or arrayref.
$result = $compiler->compile(filename => $filename); $result = $compiler->compile(scalarref => \$rhtml); $result = $compiler->compile(arrayref => \@rhtml);
you can use the Perl variables in the ERuby document. supported types are String, Hash and Array only. NO Objects. See the simple example.
Perl code
my %vars = (
'@var' => 'foo', # Ruby instance variable
'ARRAY_REF' => [qw(a b c)], # Ruby constant
'hash_ref' => {foo => 'bar', 'bar' => 'baz'} # Ruby local variable
);
my $compiler = HTML::ERuby->new;
print $compiler->compile(filename => './foo.rhtml', vars => \%vars);
ERuby document
instance variable <%= @var %> <% ARRAY_REF.each do |v| %> <%= v %> <% end %> foo: <%= hash_ref['foo'] %> bar: <%= hash_ref['baz'] %>
Result
instance variable foo a b c foo: bar bar: baz

this module is experimental.

Author <ikebe@edge.co.jp>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
