1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | NAME Catalyst::View::Mason - Mason View Class SYNOPSIS # use the helper script/create.pl view Mason Mason # lib/MyApp/View/Mason.pm package MyApp::View::Mason; use base 'Catalyst::View::Mason'; __PACKAGE__->config(use_match => 0); 1; $c->forward('MyApp::View::Mason'); DESCRIPTION Want to use a Mason component in your views? No problem! Catalyst::View::Mason comes to the rescue. EXAMPLE From the Catalyst controller: $c->stash->{name} = 'Homer'; # Pass a scalar $c->stash->{extra_info} = { last_name => 'Simpson', children => [qw(Bart Lisa Maggie)] }; # A ref works too From the Mason template: <%args> $name $extra_info </%args> <p>Your name is <strong><% $name %> <% $extra_info->{last_name} %></strong> <p>Your children are: <ul> % foreach my $child (@{$extra_info->{children}}) { <li><% $child %></li> % } </ul> METHODS new($app, \%config) get_component_path Returns the component path from $c->stash->{template} or $c->request->match or $c->action (depending on the use_match setting). process Renders the component specified in $c->stash->{template} or $c->request->match or $c->action (depending on the use_match setting) to $c->response->body. 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). Mason global variables $base, $c, and $name are automatically set to the base, context, and name of the app, respectively. render($c, $component_path, \%args) Renders the given template and returns output, or a HTML::Mason::Exception object upon error. The template variables are set to %$args if $args is a hashref, or $c->stash otherwise. config This allows you to to pass additional settings to the HTML::Mason::Interp constructor or to set the options as below: "template_extension" This string is appended (if present) to "$c->action" when generating a template path. Defaults to an empty string. Example: "template_extension => '.html'" "always_append_template_extension" Set this to a true value if you want "template_extension" to be appended to the component path even if it was explicitly set. Defaults to 0. Example: "always_append_template_extension => 1" "use_match" Use "$c->request->match" instead of "$c->action" to determine which template to use if "$c->stash->{template}" isn't set. This option is deprecated and exists for backward compatibility only. Currently defaults to 0. Old code should set this to 1 to avoid breakage. Example: "use_match => 0" The default HTML::Mason::Interp config options are as follows: "comp_root" "$app->config->root" "data_dir" "File::Spec->catdir( File::Spec->tmpdir, sprintf('%s_%d_mason_data_dir', $app, $<) )" "allow_globals" "qw/$c $name $base/" If you add additional allowed globals those will be appended to the list of default globals. SEE ALSO Catalyst, HTML::Mason, "Using Mason from a Standalone Script" in HTML::Mason::Admin AUTHORS Andres Kievsky "ank@cpan.org" Sebastian Riedel "sri@cpan.org" Marcus Ramberg Florian Ragwitz "rafl@debian.org" Justin Hunter "justin.d.hunter@gmail.com" COPYRIGHT This program is free software, you can redistribute it and/or modify it under the same terms as Perl itself. |
Commit History @dba86e95-f5d8-431e-ba22-415b5f76895b/main
0
»»
- Update Vcs-* headers for switch to salsa.debian.org Salvatore Bonaccorso 6 years ago
- update changelog gregor herrmann 7 years ago
- debian/copyright: change Copyright-Format 1.0 URL to HTTPS. gregor herrmann 7 years ago
- update changelog Salvatore Bonaccorso 8 years ago
- debian/control: Use HTTPS transport protocol for Vcs-Git URI Salvatore Bonaccorso 8 years ago
- releasing package libcatalyst-view-mason-perl version 0.19-1 gregor herrmann 8 years ago
- Drop (wrong) version from libcatalyst-perl (build) dependency. gregor herrmann 8 years ago
- Release libcatalyst-view-mason-perl 0.19-1 to unstable Lucas Kanashiro 8 years ago
- Update dependencies Lucas Kanashiro 8 years ago
- Set year of upstream copyright Lucas Kanashiro 8 years ago
- Add autopkgtest-pkg-perl Lucas Kanashiro 8 years ago
- Declare compliance with Debian policy 3.9.6 Lucas Kanashiro 8 years ago
- Bump debhelper compatibility level to 9 Lucas Kanashiro 8 years ago
- Update changelog info generated by dpt Lucas Kanashiro 8 years ago
- Update debian/changelog Lucas Kanashiro 8 years ago
- Merge tag 'upstream/0.19' Lucas Kanashiro 8 years ago
- Imported Upstream version 0.19 Lucas Kanashiro 8 years ago
- Update debian/changelog Lucas Kanashiro 8 years ago
- Add debian/upstream/metadata Lucas Kanashiro 8 years ago
- update changelog Salvatore Bonaccorso 9 years ago
- Update Vcs-Browser URL to cgit web frontend Salvatore Bonaccorso 9 years ago
- releasing package libcatalyst-view-mason-perl version 0.18-2 Damyan Ivanov 10 years ago
- fix version of broken/replaces libcatalyst-modules-perl Damyan Ivanov 10 years ago
- releasing package libcatalyst-view-mason-perl version 0.18-1 Damyan Ivanov 10 years ago
- update copyright information Damyan Ivanov 10 years ago
- update description Damyan Ivanov 10 years ago
- replace/break libcatalyst-modules-perl (<< 47~) Damyan Ivanov 10 years ago
- add missing libcatalyst-dispatchtype-regex-perl to (build)-dependencies Damyan Ivanov 10 years ago
- Initial packaging by dh-make-perl Damyan Ivanov 10 years ago
- Import original source of Catalyst-View-Mason 0.18 Damyan Ivanov 10 years ago
0
»»