in reply to Re: Sharing Variables and Routines between modules
in thread Sharing Variables and Routines between modules

Thanks for your replies all.

Having read the pod for CGI::Application gave me some valuable insight about a better way to reach my goals.

The best approach I've been able to come up with so far is this:

Write basic framework "instance" scripts: index.pl, admin.pl etc.etc.
Each script uses My_Common which contains the bulk of the software's routines.
My_Common uses My_Database and My_Globals
My_Database and My_Globals export their methods to MyCommon which in turn exports these to the instance script.

The result: shared variables and routines.
$global{'image_path'} stays in this form as does $dbh for the database handle, and both are available in index.pl and My_Common

Every new instance script simply uses My_Common, and if I decide to create other modules, these can be simply used by My_Common and I'm good to go again.

Thanks again.
  • Comment on Re^2: Sharing Variables and Routines between modules