redlemon has asked for the wisdom of the Perl Monks concerning the following question:
Fellow monks, I'm starting with Catalyst and I'm confused at the moment about how catalyst handles my request.
Basically I ran:
catalyst.pl Greet; cd Greet scripts/greet_create.pl view TT TT scripts/greet_create.pl controller Greeting echo "[% greeting %]" > root/greeting.tt
And edited 'lib/Greet/C/Greeting.pm' so it looks like this:
sub default : Private { my ( $self, $c ) = @_; $c->forward('say'); } sub say : Local { my ( $self, $c ) = @_; $c->stash->{greeting} = join q{, }, @{ $c->req->args() }; $c->stash->{template} = q{greeting.tt}; $c->forward('Greet::V::TT'); }
Now running a couple of scenarios, I get:
1. scripts/greet_test.pl / -> Congratulations, Greet is on Catalyst! 2. scripts/greet_test.pl /greeting/say/hello/world -> hello, world 3. scripts/greet_test.pl /greeting/hello/world -> greeting, hello, world 4. scripts/greet_test.pl /hi/there/greeting/say/hello/world -> hi, there, greeting, say, hello, world
Now, scenario 1 is as expected. I didn't change the main file and it presents the default blurb.
Scenario 2 is also as expected, I run the controller with the say request and it answers me back with the arguments.
But what about scene 3? Why didn't that strip the namespace from the arguments? And I'm really confused about scene 4. I would have expected that to print the same as 1.
Can someone explain this behaviour to me?
--
Lyon
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Catalyst request handling
by Anonymous Monk on Nov 22, 2005 at 17:09 UTC | |
by redlemon (Hermit) on Nov 22, 2005 at 18:16 UTC | |
Re: Catalyst request handling
by chibiryuu (Beadle) on Nov 22, 2005 at 18:13 UTC |
Back to
Seekers of Perl Wisdom