package Template::Caribou; our $AUTHORITY = 'cpan:YANICK'; # ABSTRACT: class-based HTML-centric templating system $Template::Caribou::VERSION = '1.2.1'; use Carp; use Moose::Exporter; use Template::Caribou::Role; use Template::Caribou::Tags qw/ attr /; Moose::Exporter->setup_import_methods( with_meta => [ 'template' ], as_is => [ 'attr', 'show' ], also => [ 'Template::Caribou::Role' ], ); use Moose::Util qw/ apply_all_roles /; use 5.10.0; sub show { state $shown_warning = 0; carp 'show() is deprecated, use $bou->my_template instead' unless $shown_warning++; $Template::Caribou::TEMPLATE->render(@_); } sub init_meta { my $class = shift; my %args = @_; my $meta = eval { $args{for_class}->meta }; unless ( $meta ) { $meta = Moose->init_meta(@_); eval "package $args{for_class}; use Moose;"; } apply_all_roles( $args{for_class}, 'Template::Caribou::Role' ); return $meta; } 1; __END__ =pod =encoding UTF-8 =head1 NAME Template::Caribou - class-based HTML-centric templating system =head1 VERSION version 1.2.1 =head1 SYNOPSIS package MyTemplate; use Template::Caribou; use Template::Caribou::Tags::HTML qw/ :all /; has name => ( is => 'ro' ); template page => sub { my $self = shift; html { head { title { 'Example' } }; $self->my_body; } }; template my_body => sub { my $self = shift; body { h1 { 'howdie ' . $self->name } } }; package main; my $template = MyTemplate->new( name => 'Yanick' ); print $template->page; =head1 DESCRIPTION WARNING: Codebase is alpha with extreme prejudice. Assume that bugs are teeming and that the API is subject to change. L is a L-based, class-centric templating system mostly aimed at producing sgml-like outputs, mostly HTML, but also XML, SVG, etc. It is heavily inspired by L. For a manual on how to use C, have a peek at L. When Cd within a namespace, C will apply the role L to it (and auto-turn the namespace into Moose class if it wasn't a Moose class or role already), as well as import the keywords C