[Catalyst] Creating my own controller and another question
John Napiorkowski
jjn1056 at yahoo.com
Fri Apr 28 17:11:26 CEST 2006
Thanks for such a quick reply. I'm still shaking my
head about the strange config problem. I think I'll
have to break out a separate instance of catalyst to
clarify it and try to write a test case for it.
One thing that I am rather confused about is how and
when $self and $c appear or not. I got that you have
to use the "my ($self, $c) = @_);" and not try to
shift them in the way I am used to with other perl
development. However I get into a lot of trouble when
I need the $c but only have $self (such as when I have
some controller accessors) or I have $c but not $self
(such as is the default with template toolkit
templates). I am not sure what you mean when you say:
> when Catalyst retrieves a component of any type for
> use, if the component has
> an ACCEPT_CONTEXT method it calls that with $c as an
> argument and returns the
> result.
For example, in the code snippet you suggested I could
used to override the new subroutine for a subclass of
controller, would there be any way to get the $c
context object?
> sub new {
> my $self = shift;
> my $new = $self->NEXT::new(@_);
> $new->init;
> return $new;
> }
More information about the Catalyst
mailing list