So I have a .lib file with some of my own subroutines in it that I would like to make available to the entire Catalyst app. Right now I require the file in lib/myapp.pm and I have no issues. However, whenever I try to call that subroutine in a controller, I get this error:
"Undefined subroutine &myapp::Controller::Root::my_sub called at
/home/user/myapp/lib/myapp/Controller/Root.pm line 35, <DATA> line 1003."
If I require the file I want to require in the controller, that gives me no issues. However, I would prefer to have to only load it in one place for the whole application if this was possible. Also, if I require the file within the controller, does that mean that this file is being loaded every time a request is made? (I'm using mod_perl if that makes any difference). I'd like to make this as efficient in terms of the file being loaded once for the whole app and any requests, but also loaded only in one place just for the sake of clean code. Thanks!