[Catalyst] Catalyst 5 Preview, Part 2

Alan Humphrey alan.humphrey at comcast.net
Wed Apr 6 11:16:48 CEST 2005


Is there a concept of SUPER here?  In your example, how would I ensure
that MyApp->end gets called?  Forwarding?

-----Original Message-----
From: catalyst-bounces at lists.rawmode.org
[mailto:catalyst-bounces at lists.rawmode.org] On Behalf Of Sebastian
Riedel
Sent: Monday, April 04, 2005 1:16 PM
To: catalyst at lists.rawmode.org
Subject: [Catalyst] Catalyst 5 Preview, Part 2

We've been busy today fixing inheritance, and we've finally chosen a 
solution quite similar to Mason's autohandlers. :)


     package MyApp;

     sub begin : Private {}
     sub auto : Private { return 1 }
     sub end : Private {}

     package MyApp::C::Foo;

     sub auto : Private { return 1 }
     sub bar : Local {}
     sub end : Private {}

Now if you request http://localhost:3000/foo/bar/ Cat5 would process:

     MyApp->begin;

     MyApp->auto;
     MyApp::C::Foo->auto;
     MyApp::C::Foo->bar;

     MyApp::C::Foo->end;


So we have two built in actions (begin/end) and a processing chain in 
between.

auto is a new built in action which like Mason's autohandlers gets 
called before the requested action (bar).
They also have the ability to break the chain by returning 0, which is 
very useful for authentication and stuff.

begin and end are not chained, just overloadable.

Hope this wasn't too complicated, and you get an idea how things work.

Btw. default works equivalent to Mason dhandlers. ;)

--
sebastian


_______________________________________________
Catalyst mailing list
Catalyst at lists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst




More information about the Catalyst mailing list