|Do you know where your variables are?|
Handling cascading defaultsby markjugg (Curate)
|on Aug 19, 2000 at 08:41 UTC||Need Help??|
markjugg has asked for the wisdom of the Perl Monks concerning the following question:
Hello, I'd like some advice on good perl style. I wrote a module for CGI error handling that I like the functionality of, but I think the interface needs some refinement.
The issue is this: The module needs to have some intelligent defaults, but these can be overridden by a module that calls it. For a given module that calls my error module (let's say Err.pm), it has it's own defaults, which can in turn be overridden a per-script basis.
Right now I have a routine in MyModule.pm which basically collects the values from the calling script, adds in defaults for abstent variables and returns Err::err.pm
It seems like there should be a slicker way than writing this wrapper routine to call the module though. Perhaps there is an answer somewhere in OO I can use?
I'll create some sample peusdo-code here in case someone wants to rework it for an example.
I hope that made sense. Thanks for any suggestions.