The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Egg::View::Mason - HTML::Mason for Egg View.

SYNOPSIS

  __PACKAGE__->egg_startup(
    ...
    .....
  
  VIEW=> [
    [ 'Mason' => {
      comp_root=> [
        [ main   => '/path/to/root' ],
        [ private=> '/path/to/comp' ],
        ],
      data_dir=> '/path/to/temp',
      ... other HTML::Mason option.
      } ],
    ],
  
   );

  # The VIEW object is acquired.
  my $view= $e->view('Mason');
  
  # It outputs it specifying the template.
  my $content= $view->render('hoge.tt', \%option);

DESCRIPTION

It is VIEW to use HTML::Mason.

Please add the setting of VIEW to the project to use it.

  VIEW => [
    [ Mason => { ... HTML::Mason option. (HASH) } ],
    ],

* Please refer to the document of HTML::Mason for the option to set.

It accesses the object and data by using following variable from the template.

  $e ... Object of project.
  $s ... $e->stash.
  $p ... $e->view('Mason')->params.

METHODS

new

When $e->view('Mason') is called, this constructor is called.

Please set %Egg::View::PARAMS directly from the controller to the parameter that wants to be set globally.

  %Egg::View::PARAMS= %NewPARAM;

params, param

The parameter that wants to be passed to HTML::Mason must use these methods.

render ( [TEMPLATE], [OPTION] )

TEMPLATE is evaluated and the output result (SCALAR reference) is returned.

It is given priority more than set of default when OPTION is passed.

  my $body= $view->render( 'foo.tt', [OPTION_HASH] );

render ( [TEMPLATE], [OPTION] )

TEMPLATE is evaluated and the output result (SCALAR reference) is returned.

It is given priority more than set of default when OPTION is passed.

  my $body= $view->render( 'foo.tt', [OPTION_HASH] );

output ( [TEMPLATE], [OPTION] )

The output result of the receipt from 'render' method is set in $e->response-> body.

When TEMPLATE is omitted, acquisition is tried from $view->template. see Egg::View.

If this VIEW operates as default_view, this method is called from '_dispatch_action' etc. by Egg.

  $view->output;

SEE ALSO

HTML::Mason, Egg::View, Egg::Release,

AUTHOR

Masatoshi Mizuno <lushe@cpan.org>

COPYRIGHT

Copyright (C) 2007 by 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.