=head2 Enable debug status in the environment
Normally you enable the debugging info by adding the C<-Debug> flag to
-your C<use Catalyst> statement (or C<__PACKAGE__->setup(qw/-Debug/)
-). However, you can also enable it using environment variable, so you
-can (for example) get debug info without modifying your application
-scripts. Just set C<CATALYST_DEBUG> or C<E<lt>MYAPPE<gt>_DEBUG> to a
-true value.
+your C<use Catalyst> statement . However, you can also enable it using
+environment variable, so you can (for example) get debug info without
+modifying your application scripts. Just set C<CATALYST_DEBUG> or
+C<E<lt>MYAPPE<gt>_DEBUG> to a true value.
=head2 Sessions
=head3 EXAMPLE
use parent qw/Catalyst/;
- __PACKAGE__->setup( qw/
+ use Catalyst qw/
Session
Session::Store::FastMmap
Session::State::Cookie
- /;)
+ /;
## Write data into the session
implementing roles:
use parent qw/Catalyst/;
- __PACKAGE__->setup (qw/
+ use Catalyst qw/
Authentication
Authentication::Credential::Password
Authentication::Store::Htpasswd
- Authorization::Roles
- /);
+ Authorization::Roles/;
Roles are implemented automatically when using
L<Catalyst::Authentication::Store::Htpasswd>:
=head3 EXAMPLE
use parent qw/Catalyst/;
- __PACKAGE__->setup( qw/Authentication
- Authentication::Credential::Password
- Authentication::Store::Htpasswd
- Authorization::Roles/);
+ use Catalyst qw/Authentication
+ Authentication::Credential::Password
+ Authentication::Store::Htpasswd
+ Authorization::Roles/;
__PACKAGE__->config->{authentication}{htpasswd} = "passwdfile";
control checks. Let's load it:
use parent qw/Catalyst/;
- __PACKAGE__->setup(qw/
- Authentication # yadda yadda
- Authorization::Roles
- /);
+ use Catalyst qw/
+ Authentication # yadda yadda
+ Authorization::Roles
+ /;
And now our action should look like this:
3. Add the XMLRPC plugin to MyApp.pm
- __PACKAGE__->setup( qw/-Debug Static::Simple XMLRPC/);
+ use Catalyst qw/-Debug Static::Simple XMLRPC/;
4. Add an API controller
Using the plugin is as simple as setting your use line in MyApp.pm to include:
- __PACKAGE__->setup( qw/Static::Simple/);
+ use Catalyst qw/Static::Simple/;
and already files will be served.
In your main application class (MyApp.pm), load the plugin:
- __PACKAGE__->setup( qw/-Debug FormValidator Static OtherPlugin/);
+ use Catalyst qw/-Debug FormValidator Static OtherPlugin/;
You will also need to make sure your end method does I<not> forward
static content to the view, perhaps like this:
application for a cache because the source document changes
infrequently but may be viewed many times.
- __PACKAGE__->setup( qw/Cache::FileCache/);
+ use Catalyst qw/Cache::FileCache/;
...
We can add the PageCache plugin to speed things up.
- __PACKAGE__->setup( qw/Cache::FileCache PageCache/);
+ use Catalyst qw/Cache::FileCache PageCache/;
sub front_page : Path ('/') {
my ( $self, $c ) = @_;