-
-
14 Apr 2002 01:24:24 UTC
- Distribution: HTML-ERuby
- Module version: 0.02
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues
- Testers (2 / 0 / 0)
- Kwalitee
Bus factor: 0- 90.00% Coverage
- License: unknown
- Activity
24 month- Tools
- Download (3.35KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- unknown
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
HTML::ERuby - ERuby processor for Perl.
SYNOPSIS
use HTML::ERuby; my $compiler = HTML::ERuby->new; my $result = $compiler->compile(filename => './foo.rhtml'); print $result;
DESCRIPTION
HTML::ERuby is a ERuby processor written in Perl.
parse ERuby document by Perl and evaluate by Ruby.
METHODS
- $compiler = HTML::ERuby->new
-
constructs HTML::ERuby object.
- $result = $compiler->compile(\%option)
-
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
CAVEATS
this module is experimental.
AUTHOR
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.
SEE ALSO
http://www2a.biglobe.ne.jp/~seki/ruby/erb.html
http://www.modruby.net/
Module Install Instructions
To install HTML::ERuby, copy and paste the appropriate command in to your terminal.
cpanm HTML::ERuby
perl -MCPAN -e shell install HTML::ERuby
For more information on module installation, please visit the detailed CPAN module installation guide.