Egg::View::Mason - HTML::Mason is used for View of Egg.
This is a setting example.
VIEW=> [ [ 'Mason' => { comp_root=> [ [ main => '/path/to/root' ], [ private=> '/path/to/comp' ], ], data_dir=> '/path/to/temp', ... etc. } ], ],
Example of code.
$e->stash->{param1}= "fooooo"; $e->view->param( 'param2'=> 'booooo' ); # Scalar reference is received. my $body= $e->view->render( 'template.tt' ); or # It outputs it later. $e->template( 'template.tt' );
Example of template.
<& /comp/html_header, a=> { page_title=> 'test-page' } &> <& /comp/banner_head, a=> { type => 1 } &> <& /comp/side_menu, a=> { guest=> 1 } &> <h1><% $e->stash->{param1} %></h1> <h2><% $p->{param2} %></h2> <%init> my $array= [ { name=> 'foo', value=> 'foofoofoo' }, { name=> 'baa', value=> 'baabaabaa' }, { name=> 'baa', value=> 'baabaabaa' }, ]; </%init> <div id="content"> - Your request passing: <% $e->request->path |h %><hr> - Your IP address: <% $e->request->address |h %><hr> - Test Array: % % for my $hash (@$array) { [ <% $hash->{name} |h %> = <% $hash->{value} |h %> ], % } % </div> <& /comp/html_footer &>
!! It solves it by <% $e->escape_html($var) %> when garbling in <% $var |h %>.
The following global variable can be used.
$e = Egg object.
$p = $e->view->params.
HTML::Mason, Egg::View, Egg::Component, Egg::Release,
Masatoshi Mizuno, <mizuno@bomcity.com>
Copyright (C) 2006 Bee Flag, Corp. <http://egg.bomcity.com/>, All Rights Reserved.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.
To install Egg::Release, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Egg::Release
CPAN shell
perl -MCPAN -e shell install Egg::Release
For more information on module installation, please visit the detailed CPAN module installation guide.