[Rio-pm] Catalyst

Andre Luis alpbs2003 em gmail.com
Quinta Janeiro 7 11:31:44 PST 2010


Oi pessoal

Sorry pelo "nao esta funcionando" ....

entao, segui o manual e li varios exemplos pela net

meu step-by-step foi:

# catalyst.pl teste
# cd teste/
# script/teste_create.pl controller Temp
# script/teste_create.pl view Temp::TT
# vi lib/teste/Controller/Temp.pm
== Temp.pm ==
# adicionei isso
sub list : Global {
  my ( $self, $c, @args ) = @_;
  $c->stash->{template} = 'temp.tt';

}
== Temp.pm ==

# vi lib/teste/View/Temp/TT.pm
## Esse aki segundo indicacao do daniel
__PACKAGE__->config(

         TEMPLATE_EXTENSION => '.tt2',

        #  Set the location for TT files - changes base directory for your
template files from root to root/src.
        INCLUDE_PATH => [
                teste->path_to( 'root', 'src' ),         # changes base
template dir to root/src
        ],
);

criei o arquivo root/src/temp.tt
<p> teste sssssssssssss </p>

e iniciei o server

quando acesso o /list ele retorna :

teste::View::Temp::TT directly inherits from Catalyst::View. You need to
 inherit from a subclass like Catalyst::View::TT instead.

e o debug do request, response, ...

:(


abs



2010/1/7 Daniel Hughes <dsthughes em gmail.com>

> faz muito tempo desde de usar Catalyst. mas vc checou o modulo arquivo:
> nome_do_seu_projeto/lib/nome_do_seu_projeto/View/TT.pm e.g. se usasse o
> exemplo lib/Hello/View/TT.pm - deve ser alguma coisa como em baixo. acho
> que lembro que as vezes o ´path´ e ´template extension´ defaults sao
> incompativeis com algumas versoes
>
> package nome_do_seu_projeto::View::TT;
>
> use strict;
> use base 'Catalyst::View::TT';
>
> # __PACKAGE__->config(TEMPLATE_EXTENSION => '.tt');
>
>    __PACKAGE__->config(
>
>         # Change default TT extension - .tt' to '.tt2'
>         TEMPLATE_EXTENSION => '.tt2',
>
>        #  Set the location for TT files - changes base directory for your
> template files from root to root/src.
>         INCLUDE_PATH => [
>        bed1->path_to( 'root', 'src' ),         # changes base template dir
> to root/src
>             ],
>
> dan.
> --
> Daniel S. T. Hughes M.Biochem (Hons; Oxford), Ph.D (Cambridge)
>
> -------------------------------------------------------------------------------------
> +55 21 8344 9098
> dsth em cantab.net
> dsth em cpan.org
>
> _______________________________________________
> Rio-pm mailing list
> Rio-pm em pm.org
> http://mail.pm.org/mailman/listinfo/rio-pm
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: <http://mail.pm.org/pipermail/rio-pm/attachments/20100107/d10877d7/attachment.html>


Mais detalhes sobre a lista de discussão Rio-pm