Don't ask to ask, just ask | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
For 1), you can store the $sth after you create it once; when you next use that to execute() a SQL statement, the query still remains, though the placeholder values will be replaced with the appropriate values for the new statement. So simply create these as private variables in your Guest pacakge.
For 2), you can create a function "dbi()", which when called, either creates the $dbi connection if none exists and returns it, or returns the existing dbi connection. Then in your various classes in Guest, call something like: You no longer need to pass the $dbi to each method.
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain In reply to Re: Object Oriented Pattern help
by Masem
|
|