[Catalyst] New class templates
Sebastian Riedel
sri at oook.de
Fri Oct 21 10:08:37 CEST 2005
Hi,
These are the new class templates for catalyst.pl in the upcoming 5.5.
We tried to make them friendlier by adding comments and commented out
end/default actions.
What could we change/add to make them even more friendly?
Note that these templates have to be balanced to help new catalyst
users while not distracting old ones.
************************************************************************
********
package MyApp;
use strict;
# -Debug activates the debug mode for very useful log messages
# Static::Simple will serve static files from the root directory
use Catalyst qw/-Debug Static::Simple/;
our $VERSION = '0.01';
# Configure the application
MyApp->config( name => 'MyApp' );
# Start the application
MyApp->setup;
=head1 NAME
MyApp - Catalyst based application
=head1 SYNOPSIS
script/myapp_server.pl
=head1 DESCRIPTION
Catalyst based application.
=head1 METHODS
=over 4
=item default
=cut
# Output a friendly welcome message
sub default : Private {
my ( $self, $c ) = @_;
# Hello World
$c->response->body( $c->welcome_message );
}
# Uncomment and modify this end action after adding a View class
#=item end
#
#=cut
#
#sub end : Private {
# my ( $self, $c ) = @_;
#
# # Forward to View unless response body is already defined
# $c->forward('MyApp::V::') unless $c->response->body;
#}
=back
=head1 AUTHOR
Sebastian Riedel
=head1 LICENSE
This library is free software . You can redistribute it and/or modify
it under the same terms as perl itself.
=cut
1;
************************************************************************
********
package MyApp::C::Foo;
use strict;
use base 'Catalyst::Base';
=head1 NAME
MyApp::C::Foo - Catalyst component
=head1 SYNOPSIS
See L<MyApp>
=head1 DESCRIPTION
Catalyst component.
=head1 METHODS
=over 4
# Uncomment, modify and add new actions to fit your needs
#=item default
#
#=cut
#
#sub default : Private {
# my ( $self, $c ) = @_;
#
# # Hello World
# $c->response->body('MyApp::C::Foo is on Catalyst!');
#}
=back
=head1 AUTHOR
Sebastian Riedel
=head1 LICENSE
This library is free software . You can redistribute it and/or modify
it under the same terms as perl itself.
=cut
1;
************************************************************************
********
--
sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst/attachments/20051021/1be21ce4/attachment-0001.htm
More information about the Catalyst
mailing list