Hi i don't want to repeate the same code in the controllers, so i created a sub in the main MyApp package:
sub do_stuff {
my $input = shift;
do something
}
But then i want to use it in controller MyApp::Controller::Foo
sub test : Chained('base') Args(0) {
my ($self, $c) = @_;
my $test = do_stuff($c->request->params->{s});
do something more
}
i get following error:
Caught exception in MyApp::Controller::Foo->test "Undefined subroutine &MyApp::Controller::Foo::do_stuff called at /home/student/workspace/MyApp/script/../lib/MyApp/Controller/Foo.pm line 24, line 1000."
How can i create a subroutine / function to use global in all Catalyst Controllers???