[cgiapp] CGI::Application::Plugin::HTCompiled update: need some help

Alex capfan at gmx.de
Wed Jul 22 17:09:17 EDT 2009


Dear all!

 

I opened a feature request for CAP::HTCompiled here:
https://rt.cpan.org/Public/Bug/Display.html?id=48086

 

I tried to write the modifications as far as I am able to (which is in fact
not very far).

Here is the result:

[code]

package CGI::Application::Plugin::HTCompiled;

 

use CGI::Application 4.01;

 

use 5.006;

use strict;

use warnings;

use Carp;

use Data::Dumper qw/Dumper/; # dev only

 

=head1 NAME

 

CGI::Application::Plugin::HTCompiled - Integrate with
HTML::Template::Compiled

 

=cut

 

$CGI::Application::Plugin::HTCompiled::VERSION = '1.02';

 

 

use vars qw( @ISA $VERSION @EXPORT %config );

 

@ISA = qw( Exporter AutoLoader );

 

@EXPORT = qw(

);

 

sub import {

    my $caller = scalar( caller );

    $caller->add_callback( 'load_tmpl' => \&_pass_in_self );

    goto &Exporter::import;

}

 

=head2 _pass_in_self()

 

=cut

 

sub _pass_in_self {

                my ( $self, $one, $tmpl_params, $template_file ) = @_;

                

                warn("Template param 'c' will be overwritten.") if exists
$tmpl_params->{c};

                $tmpl_params->{c} = $self;

} # /_pass_in_self

 

sub html_tmpl_class { 'HTML::Template::Compiled' }

1;

[/code]

 

But: how do I replace the html_tmpl_class() in the calling app? I don't get
how I call the init hook. I guess (at least I hope) it's something very
simple anyone of you can show me J

 

Best regards, Alex

 

 



More information about the cgiapp mailing list