in reply to Re: Modularizing CGI::Application
in thread Modularizing CGI::Application

Thanks, that did the trick (for now). I am indeed using CGI::Application::Plugin::Session, but am not using CGI::Application::Plugin::Authentication because it seems unnecessarily complex, and possibly difficult to customize to my needs. But I will look at it again carefully.

One question though -- why should I have to declare the login/logout methods in App.pm? My logic told me that defining them in sub setup  .. } should have take care of that automatically? Obviously my logic was wrong. I want to know why? Does this mean that if I create more custom modules to package related functionality together, I would have to do the use base " .. "; bit for each one of them?

--

when small people start casting long shadows, it is time to go to bed

Replies are listed 'Best First'.
Re^3: Modularizing CGI::Application
by Herkum (Parson) on Apr 29, 2007 at 12:06 UTC

    why should I have to declare the login/logout methods in App.pm? My logic told me that defining them in sub setup

    Declaring methods in the setup() only says what run-modes/methods can be executed. It does not say where those methods are, since you are putting them into the Account package but you are attempting to use them as a method in the App package the program cannot find them.

    By using 'base' you are saying, all the methods that are a part of the Account class, make them a part of the App class as well. So the program runs it will check App class first for a login() method, it cannot find it. It checks the Account class for a login() method, finds and then runs it, all is well! :)

    Does this mean that if I create more custom modules to package related functionality together, I would have to do the use base

    basically, yes. It is not easy to grasp at first, I know because I struggled with it too. Try it a couple of time and eventually you will get around to figuring it out.