[Catalyst] Catalyst and CGI::Application compared

Matt S Trout catalyst at trout.me.uk
Sun Jul 24 22:35:06 CEST 2005


On Sat, Jul 23, 2005 at 09:55:12AM -0500, Mark Stosberg wrote:
> [This message has also been posted to gmane.comp.lang.perl.modules.cgi-appplication.]
> Recently, I discovered that several CGI::Application's didn't know much
> about Catalyst, and a few Catalyst developers I corresponded with
> weren't up to date with what the CGI::Application framework could do.
> 
> So I did my own research and started a document that intends to be a neutral
> comparison: 
> 
> http://cgiapp.erlbaum.net/cgi-bin/cgi-app/index.cgi?CatalystCompared
> 
> If you find something is inaccurate, missing, or misrepresents, please
> correct it-- it's a wiki. 

Just did some fiddling with the plugin stuff, because you appeared to have
missed just how powerful the Cat. plugin system is, and how much cleaner it
is for modifying existing behaviour than a callback system or exporting
stuff into the caller's namespace (which I *hate*). Note that the "use
Catalyst" bit is just

sub import {
    my ( $class, @arguments ) = @_;

    # We have to limit $class to Catalyst to avoid pushing Catalyst upon every
    # callers @ISA.
    return unless $class eq 'Catalyst';

    my $caller = caller(0);

    unless ( $caller->isa('Catalyst') ) {
        no strict 'refs';
        push @{"$caller\::ISA"}, $class;
    }

    $caller->arguments( [@arguments] );
    $caller->setup_home;
}


so there's no reason you can't just do

use base qw/Catalyst::Plugin::Foo Catalyst/;

if you don't like it - I left your "Personally, I prefer ..." comment on
there but you seemed to think the "use Catalyst qw/.../" was the only way
so you might want to reconsider your commments.

I think maybe the session stuff needs another look as well - Flex is
actually extremely powerful, although I find some of the underlying
Apache::Session::* modules a bit naff.

-- 
     Matt S Trout           Website: http://www.shadowcatsystems.co.uk
  Technical Director        E-mail:  mst (at) shadowcatsystems.co.uk
Shadowcat Systems Ltd.



More information about the Catalyst mailing list