Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Problem with index.tt2

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


davidslv at gmail

Sep 29, 2009, 2:30 PM

Post #1 of 5 (1082 views)
Permalink
Problem with index.tt2

Hi again,

I'm following the book "Catalyst - Accelerating Perl Web Application
Development" by Jonathan Rockway (2007) with Catalyst 5.80013.

And in chapter 3 the autor says to create an index.tt2 page and said that we
don't need to do nothing cos Catalyst will recognize the index. I start the
server and it shows me the default page of catalyst.

I'm following the book, so what i done wrong?

Thanks once again!

--
David Silva - http://davidslv.com/


wbs at grepit

Sep 29, 2009, 4:11 PM

Post #2 of 5 (1003 views)
Permalink
Re: Problem with index.tt2 [In reply to]

"we don't need to do nothing" parses as "we need to do something."


Specifically, you missed:

TEMPLATE_EXTENSION => '.tt2'


also, this book has some errata:
http://www.packtpub.com/view_errata/book/catalyst-perl-web-application



-Wade

On Tue, Sep 29, 2009 at 5:30 PM, David Silva <davidslv [at] gmail> wrote:

> Hi again,
>
> I'm following the book "Catalyst - Accelerating Perl Web Application
> Development" by Jonathan Rockway (2007) with Catalyst 5.80013.
>
> And in chapter 3 the autor says to create an index.tt2 page and said that
> we don't need to do nothing cos Catalyst will recognize the index. I start
> the server and it shows me the default page of catalyst.
>
> I'm following the book, so what i done wrong?
>
> Thanks once again!
>
> --
> David Silva - http://davidslv.com/
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>
>


--
Thanks!

Wade Stuart

Phone: 917-363-6164
IM: SpaceMuscles


matt at mattwhipple

Sep 29, 2009, 4:15 PM

Post #3 of 5 (998 views)
Permalink
Re: Problem with index.tt2 [In reply to]

David Silva wrote:
> Hi again,
>
> I'm following the book "Catalyst - Accelerating Perl Web Application
> Development" by Jonathan Rockway (2007) with Catalyst 5.80013.
>
> And in chapter 3 the autor says to create an index.tt2 page and said
> that we don't need to do nothing cos Catalyst will recognize the
> index. I start the server and it shows me the default page of catalyst.
>
> I'm following the book, so what i done wrong?
My guess would be that you haven't changed the template extension. See
if index.tt works. From my recollection, the book is building on top of
the previous example and only references some of the previously covered
material rather than explicitly going through it again (so also make
sure you have the view set up).

As a note, it's not that Catalyst "recognizes the index", it's that the
view defaults to trying to display a template matching the present
action (which in this case should be "index") with the template
extension appended.

>
> Thanks once again!
>
> --
> David Silva - http://davidslv.com/
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


davidslv at gmail

Sep 30, 2009, 1:09 AM

Post #4 of 5 (982 views)
Permalink
Re: Problem with index.tt2 [In reply to]

Good Morning,

I already had set TEMPLATE_EXTENSION => '.tt2', and i solve the problem by
changing the controller Root.pm like this:

sub index :Path :Args(0) {
my ( $self, $c ) = @_;

# Hello World
# $c->response->body( $c->welcome_message );
$c->stash->{template} = 'index.tt2';
}

Thank you

2009/9/30 Matt Whipple <matt [at] mattwhipple>

> David Silva wrote:
>
>> Hi again,
>>
>> I'm following the book "Catalyst - Accelerating Perl Web Application
>> Development" by Jonathan Rockway (2007) with Catalyst 5.80013.
>>
>> And in chapter 3 the autor says to create an index.tt2 page and said that
>> we don't need to do nothing cos Catalyst will recognize the index. I start
>> the server and it shows me the default page of catalyst.
>>
>> I'm following the book, so what i done wrong?
>>
> My guess would be that you haven't changed the template extension. See if
> index.tt works. From my recollection, the book is building on top of the
> previous example and only references some of the previously covered material
> rather than explicitly going through it again (so also make sure you have
> the view set up).
>
> As a note, it's not that Catalyst "recognizes the index", it's that the
> view defaults to trying to display a template matching the present action
> (which in this case should be "index") with the template extension appended.
>
>
>> Thanks once again!
>>
>> --
>> David Silva - http://davidslv.com/
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> List: Catalyst [at] lists
>> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
>> Searchable archive:
>> http://www.mail-archive.com/catalyst [at] lists/
>> Dev site: http://dev.catalyst.perl.org/
>>
>>
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>



--
David Silva - http://davidslv.com/


matt at mattwhipple

Sep 30, 2009, 7:36 AM

Post #5 of 5 (976 views)
Permalink
Re: Problem with index.tt2 [In reply to]

David Silva wrote:
> Good Morning,
>
> I already had set TEMPLATE_EXTENSION => '.tt2', and i solve the
> problem by changing the controller Root.pm like this:
>
> sub index :Path :Args(0) {
> my ( $self, $c ) = @_;
>
> # Hello World
> # $c->response->body( $c->welcome_message );
> $c->stash->{template} = 'index.tt2';
> }
Doh...If you were getting the welcome screen it _would_ have been that
line left over. The other suggestions would have been in the case of an
error screen.

The book is referencing the fact that you don't need to set the template
stash variable in this case, but explicitly specifying things is never a
bad idea, especially when the default behavior is unclear or uncertain.
Ironically the TEMPLATE_EXTENSION is irrelevant with the above setup.
>
> Thank you
>
> 2009/9/30 Matt Whipple <matt [at] mattwhipple
> <mailto:matt [at] mattwhipple>>
>
> David Silva wrote:
>
> Hi again,
>
> I'm following the book "Catalyst - Accelerating Perl Web
> Application Development" by Jonathan Rockway (2007) with
> Catalyst 5.80013.
>
> And in chapter 3 the autor says to create an index.tt2 page
> and said that we don't need to do nothing cos Catalyst will
> recognize the index. I start the server and it shows me the
> default page of catalyst.
>
> I'm following the book, so what i done wrong?
>
> My guess would be that you haven't changed the template extension.
> See if index.tt <http://index.tt> works. >From my recollection,
> the book is building on top of the previous example and only
> references some of the previously covered material rather than
> explicitly going through it again (so also make sure you have the
> view set up).
>
> As a note, it's not that Catalyst "recognizes the index", it's
> that the view defaults to trying to display a template matching
> the present action (which in this case should be "index") with the
> template extension appended.
>
>
> Thanks once again!
>
> --
> David Silva - http://davidslv.com/
> ------------------------------------------------------------------------
>
>
>
> _______________________________________________
> List: Catalyst [at] lists
> <mailto:Catalyst [at] lists>
> Listinfo:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
>
> _______________________________________________
> List: Catalyst [at] lists <mailto:Catalyst [at] lists>
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
>
> --
> David Silva - http://davidslv.com/
> ------------------------------------------------------------------------
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>


_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.