CGI-Application-Plugin-AnyTemplate

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

          the module can use either Clone or Clone::PP - that it
          requires one (but not both) of them.  So for now, Clone is
          still listed as a prerequisite.

        - updated Template::Toolkit driver docs to indicate how to use 
          different encodings.  Thanks to Shmuel Fomberg (RT #34791).
        
        - removed spurious call to $template->error on Petal templates.
          Thanks to William McKee (RT #20221).

        - Component handler now weakens reference to containing_template,
          in an attempt to avoid crazy memory usage.  Thanks to Dan Horne
          (RT #18157).
          
        - Changes of interest to module maintainers only:
          - t/prereqs-scenarios is now included in the distribution.  
            
            This is how I simulate the absense of specific modules when 
            running the test suite.  For instance, the user may have 
            HTML::Template::Expr installed, but not HTML::Template::Pluggable.
            Or they may have Clone::PP installed, but not Clone.

lib/CGI/Application/Plugin/AnyTemplate.pm  view on Meta::CPAN

    $template->param('foo' => 'bar');
    $template->output;

See also below under L<"CHANGING THE NAME OF THE 'template' METHOD">.

=cut

use strict;
use CGI::Application;
use Carp;
use Scalar::Util qw(weaken);

if ( ! eval { require Clone } ) {
    if ( eval { require Clone::PP } ) {
        no strict 'refs';
        *Clone::clone = *Clone::PP::clone;
    }
    else {
        die "Neiter Clone nor Clone::PP found - $@\n";
    }
}

lib/CGI/Application/Plugin/AnyTemplate.pm  view on Meta::CPAN


    my $self = {
        'conf_name'      => $conf_name,
        'base_config'    => {},
        'current_config' => {},
        'webapp'         => $webapp,
    };

    bless $self, $class;

    weaken $self->{'webapp'};

    return $self;
}

sub _default_type      { 'HTMLTemplate' }
sub _default_extension { '.html'        }

=head1 METHODS

=head2 config

lib/CGI/Application/Plugin/AnyTemplate/Base.pm  view on Meta::CPAN

=head1 DESCRIPTION

This documentation is mainly for developers who want to write additional
Template drivers. For how to use the system, see the docs for
L<CGI::Application::Plugin::AnyTemplate>

=cut

use strict;
use Carp;
use Scalar::Util qw(weaken);

sub _new {
    my $proto = shift;
    my $class = ref $proto || $proto;

    my %args = @_;

    my $self = {};

    $self->{'driver_config'}     = delete $args{'driver_config'} || {};

lib/CGI/Application/Plugin/AnyTemplate/Base.pm  view on Meta::CPAN

    $self->{'callers_package'}   = delete $args{'callers_package'};
    $self->{'return_references'} = delete $args{'return_references'};
    $self->{'conf_name'}         = delete $args{'conf_name'};
    $self->{'webapp'}            = delete $args{'webapp'};

    $self->{'component_handler_class'} = delete $args{'component_handler_class'}
                                || 'CGI::Application::Plugin::AnyTemplate::ComponentHandler';

    bless $self, $class;

    weaken $self->{'webapp'};

    $self->initialize;

    return $self;
}

=head1 METHODS

=over 4

lib/CGI/Application/Plugin/AnyTemplate/ComponentHandler.pm  view on Meta::CPAN

You shouldn't need to use this module directly unless you are adding
support for a new template system.

For information on embedded components see the docs of
L<CGI::Application::Plugin::AnyTemplate>.

=cut

use strict;
use Carp;
use Scalar::Util qw(weaken);

=head1 METHODS

=over 4

=item new

Creates a new C<CGI::Application::Plugin::AnyTemplate::ComponentHandler> object.

    my $component_handler = CGI::Application::Plugin::AnyTemplate::ComponentHandler->new(

lib/CGI/Application/Plugin/AnyTemplate/ComponentHandler.pm  view on Meta::CPAN

    my $class = ref $proto || $proto;

    my %args = @_;

    my $self = {};
    bless $self, $class;

    $self->{'webapp'}              = $args{'webapp'};
    $self->{'containing_template'} = $args{'containing_template'};

    weaken $self->{'webapp'};
    weaken $self->{'containing_template'};

    return $self;
}

=item embed

Runs the specified C<runmode> of the C<webapp> object.
Returns the results of this call.

Parameters passed to embed should be passed on to the run mode.



( run in 0.269 second using v1.01-cache-2.11-cpan-65fba6d93b7 )