Mailing List Archive

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 5 Preview, Part 2 [ In reply to ]
Sorry, it's me again. :-)

I have a few questions:

> 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;

1. Why is MyApp->end not processed?

2. What would happened if a sub MyApp::C::Foo->begin had existed?

3. What happens if in MyApp a sub with :Path('/foo/bar') exists? Which
one will be called? When both are called - in which order?


Thank you,

good bye,
Uwe
Catalyst 5 Preview, Part 2 [ In reply to ]
Am 05.04.2005 um 21:20 schrieb Uwe Voelker:

> Sorry, it's me again. :-)

:)

> I have a few questions:
>
>> 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;
>
> 1. Why is MyApp->end not processed?

Because MyApp::C::Foo->end overloads it

>
> 2. What would happened if a sub MyApp::C::Foo->begin had existed?

It would overload MyApp->begin

>
> 3. What happens if in MyApp a sub with :Path('/foo/bar') exists? Which
> one will be called? When both are called - in which order?

There can be only one, so the one defined last would get executed.


--
sebastian
Catalyst 5 Preview, Part 2 [ In reply to ]
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@lists.rawmode.org
[mailto:catalyst-bounces@lists.rawmode.org] On Behalf Of Sebastian
Riedel
Sent: Monday, April 04, 2005 1:16 PM
To: catalyst@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@lists.rawmode.org
http://lists.rawmode.org/mailman/listinfo/catalyst
Catalyst 5 Preview, Part 2 [ In reply to ]
Am 06.04.2005 um 11:16 schrieb Alan Humphrey:

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

Mhm, we added the concept of unique private actions, so you can do
$c->forward('/end');

--
sebastian