Catalyst-Manual

 view release on metacpan or  search on metacpan

lib/Catalyst/Manual/Cookbook.pod  view on Meta::CPAN

Catalyst makes it easy to employ several different types of caching to
speed up your applications.

=head3 Cache Plugins

There are three wrapper plugins around common CPAN cache modules:
Cache::FastMmap, Cache::FileCache, and Cache::Memcached.  These can be
used to cache the result of slow operations.

The Catalyst Advent Calendar uses the FileCache plugin to cache the
rendered XHTML version of the source POD document.  This is an ideal
application for a cache because the source document changes
infrequently but may be viewed many times.

    use Catalyst qw/Cache::FileCache/;

    ...

    use File::stat;
    sub render_pod : Local {
        my ( self, $c ) = @_;

lib/Catalyst/Manual/Tutorial/02_CatalystBasics.pod  view on Meta::CPAN

The development server noticed the change in C<Hello::Controller::Root>
and automatically restarted itself.

Go to L<http://localhost:3000/hello> to see "Hello, World!".   Also
notice that the newly defined 'hello' action is listed under "Loaded
Private actions" in the development server debug output.


=head2 Hello, World! Using a View and a Template

In the Catalyst world a "View" itself is not a page of XHTML or a
template designed to present a page to a browser. Rather, it is the
module that determines the I<type> of view -- HTML, PDF, XML, etc. For
the thing that generates the I<content> of that view (such as a
Template Toolkit template file), the actual templates go under the
"root" directory.

To create a TT view, run:

    $ script/hello_create.pl view HTML TT

lib/Catalyst/Manual/Tutorial/03_MoreCatalystBasics.pod  view on Meta::CPAN

    );


=head2 Create the Wrapper Template File and Stylesheet

Next you need to set up your wrapper template.  Basically, you'll want
to take the overall layout of your site and put it into this file.  For
the tutorial, open F<root/src/wrapper.tt2> and input the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" [%#
        %]"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>[% template.title or "My Catalyst App!" %]</title>
    <link rel="stylesheet" href="[% c.uri_for('/static/css/main.css') %]" />
    </head>

    <body>
    <div id="outer">
    <div id="header">



( run in 0.591 second using v1.01-cache-2.11-cpan-49f99fa48dc )