Hi Monks,
I have a question regarding basic Catalyst dispatching. Lets say I have a public url like this:
/app/reporting/42
Which displays reports about the account with account_id 42. I tried this:
package MyApp::Controller::App::Reporting;
use Moose;
use namespace::autoclean;
BEGIN {
extends 'Catalyst::Controller';
}
sub reporting :Chained('chained_index') PathPart('reporting') Args(1)
+{
my( $self, $c, $account_id ) = @_;
$c->log->debug( "Generating report for account $account_if" );
}
But when I fire up my Catalyst servers I see this:
[debug] Unattached Chained actions:
.-------------------------------------+-------------------------------
+-------.
| Private | Missing parent
+ |
+-------------------------------------+-------------------------------
+-------+
| /app/reporting/reporting | /app/reporting/chained_index
+ |
'-------------------------------------+-------------------------------
+-------'
My question is how do I go about creating a method that will handle requests to urls of the form /app/reporting/id, In general I am trying to wrap my head around Catlayst controllers, in particular, how to structure controller for paths. Eventually (next week) I'll need to do create controllers to handle requests like:
/app/reporting/42/product_group/foo/product/bar
that will need to report on account id 42, product group id 'foo' and product id 'bar'. How would I do this? Thanks in advance for the help monks. Any help in the right direction would be awesome. I'm reading the docs but still not getting it.