Catalyst-View-TT-Alloy

 view release on metacpan or  search on metacpan

lib/Catalyst/View/TT/Alloy.pm  view on Meta::CPAN

#!/bin/false

use strict;
use warnings;

package Catalyst::View::TT::Alloy;
$Catalyst::View::TT::Alloy::VERSION = '0.00007';
use parent qw( Catalyst::View );

use Carp qw( croak );
use Data::Dump qw( dump );
use Path::Class;
use Scalar::Util qw( weaken blessed );
use Template::Alloy qw( Compile Parse TT );

__PACKAGE__->mk_accessors('template');
__PACKAGE__->mk_accessors('include_path');

=head1 NAME

Catalyst::View::TT::Alloy - Template::Alloy (TT) View Class

=head1 VERSION

version 0.00007

=head1 SYNOPSIS

# use the helper to create your View
    myapp_create.pl view TT::Alloy TT::Alloy

# configure in myapp.yml

    'View::TT::Alloy':
      INCLUDE_PATH:
        - __path_to(root/src)__
        - __path_to(root/lib)__
      PRE_PROCESS: 'config/main'
      WRAPPER: 'site/wrapper'
      # optional
      TEMPLATE_EXTENSION: '.tt'
      CATALYST_VAR: 'Catalyst'

# example render view in lib/MyApp/Controller/Root.pm

    sub default : Private {
        my ( $self, $c ) = @_;
        $c->stash->{template} = 'message.tt2';
        $c->stash->{message}  = 'Hello World!';
        return;
    }

    sub end : ActionClass('RenderView') {
    }

# access variables from template

    The message is: [% message %].

    # example when CATALYST_VAR is set to 'Catalyst'
    Context is [% Catalyst %]
    The base is [% Catalyst.req.base %]
    The name is [% Catalyst.config.name %]

    # example when CATALYST_VAR isn't set
    Context is [% c %]
    The base is [% base %]
    The name is [% name %]

=cut

sub _coerce_paths {
    my ( $paths, $dlim ) = shift;



( run in 1.182 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )