=head1 LOG STATEMENTS
Folks in the former group can use Catalyst's C<$c-E<gt>log> facility.
-(See L<Catalyst::Log|Catalyst::Log> for more detail.) For example, if
+(See L<Catalyst::Log> for more detail.) For example, if
you add the following code to a controller action method:
$c->log->info("Starting the foreach loop here");
-
+
$c->log->debug("Value of \$id is: ".$id);
Then the Catalyst development server will display your message along
[% c.log.debug("This is a test log message") %]
-As with many other logging facilities, you a method is defined for
+As with many other logging facilities, a method is defined for
each of the following "logging levels" (in increasing order of
severity/importance):
$c->log->error
$c->log->fatal
-You can also use L<Data::Dumper|Data::Dumper> in both Catalyst code
+You can also use L<Data::Dumper> in both Catalyst code
(C<use Data::Dumper; $c-E<gt>log-E<gt>debug("\$var is: ".Dumper($var));)>)
and TT templates (C<[% Dumper.dump(book) %]>.
"left-justify" my debug statements so I don't forget to remove them, but
you can obviously indent them if you prefer):
- sub list : Local {
+ sub list :Local {
# Retrieve the usual Perl OO '$self' for this object. $c is the Catalyst
# 'Context' that's used to 'glue together' the various components
# that make up the application
my ($self, $c) = @_;
$DB::single=1;
-
+
# Retrieve all of the book records as book model objects and store in the
# stash where they can be accessed by the TT template
$c->stash->{books} = [$c->model('DB::Book')->all];
-
+
# Set the TT template to use. You will almost always want to do this
# in your action methods.
$c->stash->{template} = 'books/list.tt2';
mkdir -p lib/Module; cp `perldoc -l Module::Name` lib/Module/
-Note: If you are following along in Debian 5 or Ubuntu, you will
+Note: If you are following along in Debian 6 or Ubuntu, you will
need to install the C<perl-doc> package to use the C<perldoc> command.
Use C<sudo aptitude install perl-doc> to do that.
For example, you could make a copy of
-L<Catalyst::Plugin::Authentication|Catalyst::Plugin::Authentication>
+L<Catalyst::Plugin::Authentication>
with the following command:
mkdir -p lib/Catalyst/Plugin; cp \
Check the version of an installed module:
- perl -ME<lt>mod_nameE<gt> -e '"print $E<lt>mod_nameE<gt>::VERSION\n"'
+ perl -M<mod_name> -e 'print "$<mod_name>::VERSION\n"'
For example:
If you run into issues during the rendering of your template, it might
be helpful to enable TT C<DEBUG> options. You can do this in a Catalyst
environment by adding a C<DEBUG> line to the C<__PACKAGE__->config>
-declaration in C<lib/MyApp/View/TT.pm>:
+declaration in C<lib/MyApp/View/HTML.pm>:
__PACKAGE__->config({
TEMPLATE_EXTENSION => '.tt2',
There are a variety of options you can use, such as 'undef', 'all',
'service', 'context', 'parser' and 'provider'. See
-L<Template::Constants|Template::Constants> for more information
+L<Template::Constants> for more information
(remove the C<DEBUG_> portion of the name shown in the TT docs and
convert to lower case for use inside Catalyst).
Kennedy Clark, C<hkclark@gmail.com>
-Please report any errors, issues or suggestions to the author. The
-most recent version of the Catalyst Tutorial can be found at
+Feel free to contact the author for any errors or suggestions, but the
+best way to report issues is via the CPAN RT Bug system at
+<https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-Manual>.
+
+The most recent version of the Catalyst Tutorial can be found at
L<http://dev.catalyst.perl.org/repos/Catalyst/Catalyst-Manual/5.80/trunk/lib/Catalyst/Manual/Tutorial/>.
-Copyright 2006-2008, Kennedy Clark, under Creative Commons License
+Copyright 2006-2010, Kennedy Clark, under the
+Creative Commons Attribution Share-Alike License Version 3.0
(L<http://creativecommons.org/licenses/by-sa/3.0/us/>).