[Catalyst] some basic Catalyst theory questions

Sebastian Riedel sri at oook.de
Tue Jun 7 01:03:05 CEST 2005


Am 07.06.2005 um 00:46 schrieb Perrin Harkins:

> On Tue, 2005-06-07 at 00:15 +0200, Sebastian Riedel wrote:
>
>> It's up to you how to handle them...
>> But unhandled exceptions are collected and presented on the sweet
>> debug screen in -Debug mode.
>>
>
> If it always catches my exceptions in an eval{} block, how does it  
> know
> if I handled them or not?  Do I have to check some return code after
> every forward() call?  That would be a bit backwards.  Is there an
> example of exception handling somewhere?

No examples, but errors are available in $c->error.
You could also use NEXT and extend Catalyst::Engine::execute.
There are many ways.

>
>> No wait, you asked for $c->req->params which are the parameters.
>> You want arguments $c->req->args.
>>
>
> I don't think I do.  I mean handling for URLs like /foo?key=value  
> where
> I want to read the value of "key".  What are args?  Is this some  
> way to
> pass additional arguments in a forward?  I don't recall seeing it  
> in the
> docs.

That would be simply $c->req->params->{key}.

Now args, say we have a action "/foo" and you request  "/foo/bar/yada/ 
23"

@{ $c->req->args } would contain qw/bar yada 23/.

>
>
>> You can access them via @{ $c->req->args } or directly in your  
>> actions
>>
>>      sub action : Local {
>>          my ( $self, $c, $arg1, $arg2, $arg3... ) = @_;
>>      }
>>
>> We try to give you as much syntactic sugar as possible with perl5,
>> but the perl6 port i'm working on will be much sweeter!!! ;)
>>
>
> I don't want to sound too harsh, but frankly, if you want Catalyst to
> succeed I think you should forget about Perl6 and work on the docs.
> It's not very obvious how all of these things are supposed to work,  
> and
> code generation helpers only go so far.

Catalyst is a quite big project, we have a bunch of people dedicated  
to docs... i just need to "motivate" them a bit more! :)
I'm the only one working on the port actually, and i already ported  
most prereqs, and it's no big deal...

Perl6 is no more that far away, i'm very happy with Pugs, and love to  
contribute to the real "community rewrite of Perl"!

--
sebastian




More information about the Catalyst mailing list