in reply to Re: Packaging up my code sensibly
in thread Packaging up my code sensibly

At this point I wanted to keep things simple, so I didn't use Config::Simple. My home.conf is just --

$WIKI_TITLE = 'MyWiki'; $DEFAULT_TARGET = 'WelcomeToMyWiki'; $DEFAULT_ACTION = 'view'; $DEBUGGING = 0; $PAGENAME_PATTERN = "[A-Z][a-z0-9]+([A-Z][a-z0-9]+)+"; $EMAIL_PATTERN = '\w+@\w+\.\w+'; $DB = '/Volumes/koel/Users/punkish/Sites/mywiki/data/myw +iki.db'; $TEMPLATE_PATH = '/Volumes/koel/Users/punkish/Sites/mywiki/template +s'; $TEMPLATE_URL = '/~punkish/mywiki/templates'; $CGIPATH = '/Volumes/koel/Users/punkish/Sites/mywiki/index.cg +i'; $CGIURL = '/~punkish/mywiki';

--

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

Replies are listed 'Best First'.
Re^3: Packaging up my code sensibly
by tlm (Prior) on Jun 13, 2005 at 13:22 UTC

    I think you will find it useful to become acquainted with Exporter, which is one of Perl's standard mechanisms for facilitating code sharing (basically it streamlines the process of importing identifiers from different namespaces, so that you don't need to prepend their package names).

    Other than this, I couldn't answer your question in a node of "reasonable length" (though a more knowledgeable monk might; after all, economy is a mark of mastery). I think that a book-length treatment of modules and/or OO in Perl (like the Alpaca book or Object Oriented Perl) would be the place to look for answers.

    As far as your sharing your config data, if I wanted to keep things as simple as you have them, one possibility (which is similar to wazoox's proposal but without the singleton idea from OO design) is to use a hash to hold all the config info, along with a barebones accessor for it.

    the lowliest monk