in reply to Passing Database handles to other modules. #2

Right now, the form validation package is built as a generic package that I can reuse. I'm passing in a ref to the dbh when needed -- and that works fine, but its a little annoying, as I feel that I'm passing the ref around alot.

Is the form validation package functional/procedural or object oriented? If the former maybe you want to consider moving to the latter so you can have the $dbh become part of the object state and only pass it the once at object creation time.

  • Comment on Re: Passing Database handles to other modules. #2

Replies are listed 'Best First'.
Re: Re: Passing Database handles to other modules. #2
by nmerriweather (Friar) on May 10, 2004 at 23:25 UTC
    It is indeed oop, and thats a method that i've played with!
      It is indeed oop, and thats a method that i've played with!

      In that case, if you're still finding that you're creating lots of instances of your validation object in different places, I'd suspect that there is a layer of abstraction that's being missed somewhere.

      Are their other arguments that are similar between multiple instances? Would it make sense to make a factory object of some kind for creating similar validation objects?

      I'd tend to want to keep passing in the ref somewhere because it keeps everything decoupled and makes testing easier.