[Catalyst] Catalyst actions
Richard Jones
ra.jones at dpw.clara.co.uk
Thu May 17 22:00:23 GMT 2007
John Napiorkowski wrote:
> Hi,
>
> If you want your search method to be at url /search
> try defining it with a Path('') attribute (explicitly
> setting to empty). Or put this stuff in your Root.pm
> controller, which defines it's action namespace to
> '/'.
Hi John,
Changing Path to Path('') caused the following error, which is a new one
to me:
Caught exception in MyApp::Controller::Search->process
"MyApp::Controller::Search did not override Catalyst::Component::process
at C:/usr/local/site/lib/Catalyst/Action.pm line 70"
Moving everything to Root is going to take a little longer, at the
moment it's generating other errors, such as templates not in their
expected location.
> BTW, you can spot all the private and public
> namespaces for you application when it starts up. It
> gives a long debug info screen which is very helpful.
I know, it shows loaded Private and Path actions, and something which
looks like a step-wise path trace through the application. I can see the
error as an entry in the log under [error], but AFAICT it doesn't show
which method is generating it. Eg, an error following $c->detach is
q{Couldn't render template - "file error - search/search: not found"},
but I don't know which method is responsible for it. Does it mean it
can't find the template? If so that is odd as each method has the
template specified in $c->stash->{template}, and they are all of .tt2
suffix.
> of mapping are somewhat deprecated. I tend to use
> action chains mostly now, and sometimes Path. Default
I haven't tried chained actions yet - perhaps they are the right way to
go for this purpose?
> If this is too confusing then you can just put
> everything into the Root.pm controller. Then it's like
> building a CGI::Application webapp, which might be
> easier to get. The main advantage to breaking out
One of the reasons I decided to re-write my original if-elsif-else style
app in Catalyst is that I began the re-write in CGI::App and then
realised I was going to have exactly the same long list of methods,
albeit in the form of the much better organised CGI:App run-modes.
Now I expect I will end up with quite a few Catalyst controllers, and
don't want to 'slip back' into the arrangement where everything is in
one script. But the search function might be one exception though, as it
is one of the central parts of the application, and also the default
entry page after login.
--
Richard Jones
Leeds, UK
More information about the Catalyst
mailing list