[Catalyst] Still Confused
Chisel Wright
chisel at herlpacker.co.uk
Fri Apr 8 21:59:41 CEST 2005
I'm working with v5 at the moment, primarily because that's what the
mojomojo app I was pointed at seems to use [based on use of subs with
attributes].
I've managed to confuse myself again, I've done the following:
catalyst.pl Magic
cd Magic
./script/create.pl controller Trick
I've tweaked lib/Magic.pm to:
sub default : Private {
my ( $self, $c ) = @_;
$c->forward( '/trick' );
}
sub trick : Private {
my ( $self, $c ) = @_;
$c->res->output(__PACKAGE__ . ' : trick');
}
Then I tried:
./script/test.pl
[snippage]
.=-----------------------
| Action
|=-----------------------
| -> /trick
| /default
'=-----------------------
Magic : trick
followed by
./script/test.pl /trick
[snippage]
.=-----------------------
| Action
|=-----------------------
| /trick/default
'=-----------------------
Congratulations, Magic::C::Trick is on Catalyst!
This is where my fundamental misunderstanding of everything starts to
become apparent ...
What should I do to be forwarded to Magic::C::Trick when I visit, well
anything that's not a /trick URI already.
I would have expected forward('trick') to use the lib/Magic.pm->trick()
function, and forward('/trick') to be treated the same way as
./script/test.pl /trick
I've tried to work this out, but for some reason I just can't get the
right incantations through my keyboard at the moment.
Chisel
--
Chisel Wright
e: chisel at herlpacker.co.uk
w: http://www.herlpacker.co.uk/
"This is not the greatest sig in the world, no, this is just a tribute."
More information about the Catalyst
mailing list