Template-Declare-0.46/0000755000175000017500000000000012065721116013564 5ustar chmrrchmrrTemplate-Declare-0.46/lib/0000755000175000017500000000000012065721116014332 5ustar chmrrchmrrTemplate-Declare-0.46/lib/Template/0000755000175000017500000000000012065721116016105 5ustar chmrrchmrrTemplate-Declare-0.46/lib/Template/Declare.pm0000644000175000017500000014511412065720064020011 0ustar chmrrchmrruse 5.006; use warnings; use strict; package Template::Declare; use Template::Declare::Buffer; use Class::ISA; use String::BufferStack; our $VERSION = '0.46'; use base 'Class::Data::Inheritable'; __PACKAGE__->mk_classdata('dispatch_to'); __PACKAGE__->mk_classdata('postprocessor'); __PACKAGE__->mk_classdata('strict'); __PACKAGE__->mk_classdata('templates'); __PACKAGE__->mk_classdata('private_templates'); __PACKAGE__->mk_classdata('buffer'); __PACKAGE__->mk_classdata('imported_into'); __PACKAGE__->mk_classdata('around_template'); __PACKAGE__->dispatch_to( [] ); __PACKAGE__->postprocessor( sub { return wantarray ? @_ : $_[0] } ); __PACKAGE__->templates( {} ); __PACKAGE__->private_templates( {} ); __PACKAGE__->buffer( String::BufferStack->new ); __PACKAGE__->around_template( undef ); *String::BufferStack::data = sub { my $ref = shift; if (@_) { warn "Template::Declare->buffer->data called with argument; this usage is deprecated"; ${$ref->buffer_ref} = join("", @_); } return $ref->buffer; }; our $TEMPLATE_VARS; =head1 NAME Template::Declare - Perlish declarative templates =head1 SYNOPSIS Here's an example of basic HTML usage: package MyApp::Templates; use Template::Declare::Tags; # defaults to 'HTML' use base 'Template::Declare'; template simple => sub { html { head {} body { p { 'Hello, world wide web!' } } } }; package main; use Template::Declare; Template::Declare->init( dispatch_to => ['MyApp::Templates'] ); print Template::Declare->show( 'simple' ); And here's the output:

Hello, world wide web!

=head1 DESCRIPTION C is a pure-Perl declarative HTML/XUL/RDF/XML templating system. Yes. Another one. There are many others like it, but this one is ours. A few key features and buzzwords: =over =item * All templates are 100% pure Perl code =item * Simple declarative syntax =item * No angle brackets =item * "Native" XML namespace and declaration support =item * Mixins =item * Inheritance =item * Delegation =item * Public and private templates =back =head1 GLOSSARY =over =item template class A subclass of Template::Declare in which one or more templates are defined using the C