.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Catalyst::View::Mason 3pm" .TH Catalyst::View::Mason 3pm "2014-12-29" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Catalyst::View::Mason \- Mason View Class .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # use the helper \& script/create.pl view Mason Mason \& \& # lib/MyApp/View/Mason.pm \& package MyApp::View::Mason; \& \& use base \*(AqCatalyst::View::Mason\*(Aq; \& \& _\|_PACKAGE_\|_\->config(use_match => 0); \& \& 1; \& \& $c\->forward(\*(AqMyApp::View::Mason\*(Aq); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Want to use a Mason component in your views? No problem! Catalyst::View::Mason comes to the rescue. .SH "EXAMPLE" .IX Header "EXAMPLE" From the Catalyst controller: .PP .Vb 5 \& $c\->stash\->{name} = \*(AqHomer\*(Aq; # Pass a scalar \& $c\->stash\->{extra_info} = { \& last_name => \*(AqSimpson\*(Aq, \& children => [qw(Bart Lisa Maggie)] \& }; # A ref works too .Ve .PP From the Mason template: .PP .Vb 11 \& <%args> \& $name \& $extra_info \& \&

Your name is <% $name %> <% $extra_info\->{last_name} %> \&

Your children are: \&

.Ve .SH "METHODS" .IX Header "METHODS" .SS "new($app, \e%config)" .IX Subsection "new($app, %config)" .SS "get_component_path" .IX Subsection "get_component_path" Returns the component path from \f(CW$c\fR\->stash\->{template} or \&\f(CW$c\fR\->request\->match or \f(CW$c\fR\->action (depending on the use_match setting). .SS "process" .IX Subsection "process" Renders the component specified in \f(CW$c\fR\->stash\->{template} or \f(CW$c\fR\->request\->match or \f(CW$c\fR\->action (depending on the use_match setting) to \f(CW$c\fR\->response\->body. .PP Note that the component name must be absolute, or is converted to absolute (i.e., a / is added to the beginning if it doesn't start with one). .PP Mason global variables \f(CW$base\fR, \f(CW$c\fR, and \f(CW$name\fR are automatically set to the base, context, and name of the app, respectively. .ie n .SS "render($c, $component_path, \e%args)" .el .SS "render($c, \f(CW$component_path\fP, \e%args)" .IX Subsection "render($c, $component_path, %args)" Renders the given template and returns output, or a HTML::Mason::Exception object upon error. .PP The template variables are set to %$args if \f(CW$args\fR is a hashref, or \&\f(CW$c\fR\->stash otherwise. .PP \fIconfig\fR .IX Subsection "config" .PP This allows you to to pass additional settings to the HTML::Mason::Interp constructor or to set the options as below: .ie n .IP """template_extension""" 4 .el .IP "\f(CWtemplate_extension\fR" 4 .IX Item "template_extension" This string is appended (if present) to \f(CW\*(C`$c\->action\*(C'\fR when generating a template path. .Sp Defaults to an empty string. .Sp Example: \f(CW\*(C`template_extension => \*(Aq.html\*(Aq\*(C'\fR .ie n .IP """always_append_template_extension""" 4 .el .IP "\f(CWalways_append_template_extension\fR" 4 .IX Item "always_append_template_extension" Set this to a true value if you want \f(CW\*(C`template_extension\*(C'\fR to be appended to the component path even if it was explicitly set. .Sp Defaults to 0. .Sp Example: \f(CW\*(C`always_append_template_extension => 1\*(C'\fR .ie n .IP """use_match""" 4 .el .IP "\f(CWuse_match\fR" 4 .IX Item "use_match" Use \f(CW\*(C`$c\->request\->match\*(C'\fR instead of \f(CW\*(C`$c\->action\*(C'\fR to determine which template to use if \f(CW\*(C`$c\->stash\->{template}\*(C'\fR isn't set. This option is deprecated and exists for backward compatibility only. .Sp Currently defaults to 0. Old code should set this to 1 to avoid breakage. .Sp Example: \f(CW\*(C`use_match => 0\*(C'\fR .PP The default HTML::Mason::Interp config options are as follows: .ie n .IP """comp_root""" 4 .el .IP "\f(CWcomp_root\fR" 4 .IX Item "comp_root" \&\f(CW\*(C`$app\->config\->root\*(C'\fR .ie n .IP """data_dir""" 4 .el .IP "\f(CWdata_dir\fR" 4 .IX Item "data_dir" \&\f(CW\*(C`File::Spec\->catdir( File::Spec\->tmpdir, sprintf(\*(Aq%s_%d_mason_data_dir\*(Aq, $app, $<) )\*(C'\fR .ie n .IP """allow_globals""" 4 .el .IP "\f(CWallow_globals\fR" 4 .IX Item "allow_globals" \&\f(CW\*(C`qw/$c $name $base/\*(C'\fR .Sp If you add additional allowed globals those will be appended to the list of default globals. .SH "SEE ALSO" .IX Header "SEE ALSO" Catalyst, HTML::Mason, \*(L"Using Mason from a Standalone Script\*(R" in HTML::Mason::Admin .SH "AUTHORS" .IX Header "AUTHORS" .ie n .IP "Andres Kievsky ""ank@cpan.org""" 4 .el .IP "Andres Kievsky \f(CWank@cpan.org\fR" 4 .IX Item "Andres Kievsky ank@cpan.org" .PD 0 .ie n .IP "Sebastian Riedel ""sri@cpan.org""" 4 .el .IP "Sebastian Riedel \f(CWsri@cpan.org\fR" 4 .IX Item "Sebastian Riedel sri@cpan.org" .IP "Marcus Ramberg" 4 .IX Item "Marcus Ramberg" .ie n .IP "Florian Ragwitz ""rafl@debian.org""" 4 .el .IP "Florian Ragwitz \f(CWrafl@debian.org\fR" 4 .IX Item "Florian Ragwitz rafl@debian.org" .ie n .IP "Justin Hunter ""justin.d.hunter@gmail.com""" 4 .el .IP "Justin Hunter \f(CWjustin.d.hunter@gmail.com\fR" 4 .IX Item "Justin Hunter justin.d.hunter@gmail.com" .PD .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2005 \- 2009 the Catalyst::View::Mason \*(L"\s-1AUTHORS\*(R"\s0 as listed above. .PP This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself.