in reply to Re: Re: Class Questions, OOP, and mod_perl -- HELP
in thread Class Questions, OOP, and mod_perl -- HELP

I don't know anything about your application, but passing an Apache request object ($r) to your User class sets off all kinds of alarm bells. You usually want your data model classes to be totally independent of the environment they run in, e.g. you should be able to call your User class in a cron job that does some batch process on Users.
  • Comment on Re: Re: Re: Class Questions, OOP, and mod_perl -- HELP

Replies are listed 'Best First'.
Re: Re: Re: Re: Class Questions, OOP, and mod_perl -- HELP
by nmerriweather (Friar) on Apr 29, 2004 at 18:01 UTC
    I struggled with that.. but this user/class is just for mod_perl applications, and this seemed the easiest way to get at the specific data i needed into the user object (ie, the cookie/get/post input/session ids) for a while I had:
    $r = apache request; $session_and_form = new myPackage::session_and_form( \$r); $user = new myPackage::User(\$session); $page = new myPackage::Page(\$user)
    but it seemed more right just sending the apache ref to the user, and have the user create internal refs to the session/form info it needs on init
    im new to mod_perl, as is very evident by my questions and approach. i'm bound to be doing manny things wrong... but its working.