[Catalyst] Helper classes shared across multiple controllers - any
recommendations?
Stefan Kühn
ducdebreme at early-dance.de
Wed Oct 10 07:01:47 GMT 2007
I would like to provide functionality to multiple controllers. Imagine, you
have a funny class "Funny.pm" as __part of your catalyst app__ .
I could create the helper class in a directory below my app e.g.
/Cat/Helper/Funny.pm
Then, I could use the class in a Controller "Test":
---
package Cat::Controller::Test;
use strict;
use warnings;
use base 'Catalyst::Controller';
use Cat::Helper::Funny; ## <-- this is the funny class
sub index : Private {
my ( $self, $c ) =3D @_;
# do funny stuff
my $fun =3D Cat::Helper::Funny->new( %some_params );
my $funny_result =3D $fun->do_calculate();
# .... some more steps ...
}
1;
---
My questions:
- Is this a could way to solve the problem? (may be best practice?)
- Any other suggestions?
Stefan
-- =
---------------------------------------------------------------------------=
--
Stefan Kuehn - Le Duc de Br=EAme
The Calendar of Historical Dance -- http://www.early-dance.de
---------------------------------------------------------------------------=
--
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20071010/a9fde=
6c6/attachment.htm
More information about the Catalyst
mailing list