NAME

Catalyst::View::Haml - Haml View Class for Catalyst

SYNOPSIS

New to Haml? Check out http://haml-lang.com/tutorial.html. This module lets you create a Haml view for your Catalyst application:

package MyApp::View::Web;
use Moose;
extends 'Catalyst::View::Haml';

# ...your custom code here...

1;

or use the helper to create it for you:

myapp_create.pl view Web Haml

then you can write your templates in Haml!

#content
  .left.column
    %h2 Welcome to our site!
    %p= $information
  .right.column
    = $item->{body}

If you want to omit sigils in your Haml templates, just set the 'vars_as_subs' option:

package MyApp::View::Web;
use Moose;
extends 'Catalyst::View::Haml';

has '+vars_as_subs', default => 1;

1;

this way the Haml template above becomes:

#content
  .left.column
    %h2 Welcome to our site!
    %p= information
  .right.column
    = item->{body}

CONFIGURATION

You may specify the following configuration items in from your config file or directly on the view object.

catalyst_var

The name used to refer to the Catalyst app object in the template

template_extension

The suffix used to auto generate the template name from the action name (when you do not explicitly specify the template filename); Defaults to '.haml'

charset

The charset used to output the response body. The value defaults to 'UTF-8'.

path

Array reference specifying one or more directories in which template files are located. Defaults to your application's "root" directory.

format

Sets Haml output format. Can be set to 'xhtml', 'html' or 'html5'. Defaults to 'xhtml'.

vars_as_subs

When set to true, Perl variables become lvalue subroutines, so you can use them in you Haml templates without sigils. Default is false.

escape_html

Switch on/off Haml output html escaping. Default is on.

TODO

  • CACHE (!)

  • filters

  • helpers

  • Missing Text::Haml options

AUTHOR

Breno G. de Oliveira, <garu at cpan.org>

BUGS

Please report any bugs or feature requests to bug-catalyst-view-haml at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-Haml. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Catalyst::View::Haml

You can also look for information at:

ACKNOWLEDGEMENTS

Viacheslav Tykhanovskyi (vti) for his awesome Text::Haml implementation of Haml, the entire Haml and Catalyst teams of devs, and Daisuke Maki (lesterrat) for Catalyst::View::Xslate, from which lots of this code was borrowed (sometimes nearly verbatim).

LICENSE AND COPYRIGHT

Copyright 2010 Breno G. de Oliveira.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.