Thank you for you detailed comments! I'll comment on those related to Catalyst core.

Perl has well-established ways to set up inheritance. Messing with the caller's @ISA from your module's import() method is not a clean way to do it, and the documentation doesn't mention it being done at all. It does the same for the dispatcher class.

There is nothing that stops you from setting up the application class manually, but by doing that you'll probably miss some very convenient features that Catalyst offers.

Here is an example of doing it manually:

package MyApp; use strict; use warnings; use base qw[ Catalyst Catalyst::Plugin::Email Catalyst::Plugin::Static Catalyst::Dispatcher Catalyst::Engine::HTTP ]; MyApp->engine('Catalyst::Engine::HTTP'); MyApp->dispatcher('Catalyst::Dispatcher'); MyApp->log( Catalyst::Log->new ); MyApp->config( home => '/path/to/my/home', root => '/path/to/my/home/root' ); MyApp->setup; 1;

Catalyst will automagically try to find the best Engine class for it's environment, so if you do it your self you'll have to create several application classes, one for each environment: development, testing and deployment.

I agree that the documentation could be more clear about what import() is does.

As long as we're talking about this code, I would also suggest breaking up this long method into smaller ones

This has been on my TODO for a while, the import has now been broken down to five methods.

and avoiding the use of UNIVERSAL::require to put a method into everyone else's namespace, but those are very minor things.

This could be done, but i don't see the benefits of doing that. Using UNIVERSAL::require gives less and more readable code IMO.


In reply to Re^5: What CPAN modules are "good reads"? by Hansen
in thread What CPAN modules are "good reads"? by tlm

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.