[Catalyst] nothing printed

Octavian Rasnita orasnita at fcc.ro
Sat Mar 18 17:41:06 CET 2006


Hi,

I have tried creating the tutorial project under Windows 2000 just like
Catalyst::Manual::Tutorial says, but nothing is printed on the web page when
accessing:

http://localhost:3000/users/greet

For any other URL the default welcome message is printed as it should.

Am I doing something wrong?

Thank you.

Here are the files tutorial.pm, TToolkit.pm and Users.pm:

### tutorial.pm

package tutorial;

use strict;
use warnings;

use Catalyst qw/-Debug ConfigLoader Static::Simple/;

our $VERSION = '0.01';

#I have created the dir "templates" and put the file greet.tt in it

__PACKAGE__->config( name => 'tutorial',
'View::TToolkit' => {
'INCLUDE_PATH' => __PACKAGE__->path_to('templates')
}
);

__PACKAGE__->setup;

sub default : Private {
my ( $self, $c ) = @_;

# Hello World
$c->response->body( $c->welcome_message );
}

sub end : Private {
my ($self, $c) = @_;
$c->forward('tutorial::View::TToolkit') unless $c->res->body();
}

1;


### the file Users.pm

package tutorial::Controller::Users;

use strict;
use warnings;
use base 'Catalyst::Controller';

sub greet : Local {
my ($self, $c) = @_;

my $name = $c->req->param('name');
$c->log->debug("Got name: $name\n");

if ($c->req->method eq 'POST') {
if(!$name) {
$c->stash->{message} = 'Please fill in a name!';
}
else {
$c->stash->{message} = "Hello $name!";
}
}
$c->stash->{template} = 'greet.tt';
}

1;

### the file TToolkit.pm

package tutorial::View::TToolkit;

use strict;
use base 'Catalyst::View::TT';

1;

Teddy




More information about the Catalyst mailing list