[Catalyst] accessing action methods in a TT view

Robert 'phaylon' Sedlacek phaylon at dunkelheit.at
Thu Jul 13 17:25:33 CEST 2006


John Napiorkowski said:

> Now in the TT view you have the stash and the context but I find no easy
> way to access the $self->xxx stuff. I know it can be considered bad form
> to have too much interaction between your template and your logic, but I
> do have uses for this.  Usually I just do something like $c->stash->{self}
> = \$self;  whereever I need it but this get's awefully redundant and makes
> my FRY ruby friends snicker at me.

I usually abstract it one level more and make a

  sub auto : Private {
      my ( $self, $c ) = @_;
      $c->stash->{ do_stuff } = sub { ... };

      1;
  }

In most of my cases, the things I want to provide to my view from my
controller involve more than one action.


hth, p




More information about the Catalyst mailing list