sman has asked for the wisdom of the Perl Monks concerning the following question:

Hello, Does anyone know why I need to load Catalyst::Plugin::Authentication when I want to use $c->authenticate() like the following:

use Catalyst qw/Authentication/;
my $status = $c->authenticate(
	{
		username => $username,
		password => $password
	}
);

but no need to load Catalyst::Log when I use log like the following:

$c->log->debug('test')

Does that mean Catalyst context ($c) comes with some default loaded modules like Catalyst::Log ?

Where can I get a document listing such default loaded modules?

Thanks a lot in advance.

Replies are listed 'Best First'.
Re: A question of Catalyst
by FalseVinylShrub (Chaplain) on Jan 18, 2010 at 07:43 UTC

    Hi

    Yes. Catalyst::Log is built into Catalyst (but can be overridden with another plugin if desired).

    The best place I know to get a list of 'core' module names is to check what's in the Catalyst-Runtime distribution (select your version). However I don't know if this is exhaustive because I'm not sure what else is installed with Catalyst (I just did cpan Catalyst, wait, yes, yes, wait, yes, wait, yes, etc.)

    FalseVinylShrub

    Disclaimer: Please review and test code, and use at your own risk... If I answer a question, I would like to hear if and how you solved your problem.

      Thanks for your reply. I guess we can tell the default-loaded modules via investigating the source of Catalyst.pm like the following :

      use Moose; use Moose::Meta::Class (); extends 'Catalyst::Component'; use Moose::Util qw/find_meta/; use B::Hooks::EndOfScope (); use Catalyst::Exception; use Catalyst::Exception::Detach; use Catalyst::Exception::Go; use Catalyst::Log; use Catalyst::Request; use Catalyst::Request::Upload; use Catalyst::Response; use Catalyst::Utils; use Catalyst::Controller; use Devel::InnerPackage (); use File::stat; use Module::Pluggable::Object (); use Text::SimpleTable (); use Path::Class::Dir (); use Path::Class::File (); use URI (); use URI::http; use URI::https; use Tree::Simple qw/use_weak_refs/; use Tree::Simple::Visitor::FindByUID; use Class::C3::Adopt::NEXT; use List::MoreUtils qw/uniq/; use attributes; use utf8; use Carp qw/croak carp shortmess/;
Re: A question of Catalyst
by Khen1950fx (Canon) on Jan 18, 2010 at 07:36 UTC