atcroft has asked for the wisdom of the Perl Monks concerning the following question:
I have questions regarding how to make a module behave intelligently in two particular situations. I would be appreciative of any insights that can be provided, or references that can be pointed out that would be appropriate to the subjects.
Situation 1: Suppose that there are two modules, which we will refer to as Foo::Bar and Baz::Quux. I wish to write a module (Blarg::Wibble) which may deal with an object produced by either of these two modules. I know that I could probably write something like Blarg::Wibble::Foo_Bar and Blarg::Wibble::Baz_Quux, each of which able to work on one kind of object or the other. How could I make it so that another programmer would only have to 'use Blarg::Wibble' and pass it the object (created from either Foo::Bar or Baz::Quux), and have the module be smart enough to use the appropriate functions from either Blarg::Wibble::Foo_Bar or Blarg::Wibble::Baz_Quux?
Situation 2: During the 'make test' phase of the install process, how would one go about making it so that if Baz::Quux was missing that it would skip testing for that, but would be able to work later if, in the interim, Baz::Quux had been installed?
-----
(WRT - With Respect To)
Update: Thanks to bart for letting me know that I had, while editing, left out part of the first sentence of the first paragraph. Corrected.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Question about creating intelligent behaviors in modules WRT external objects/modules
by bart (Canon) on Feb 21, 2006 at 08:47 UTC | |
|
Re: Question about creating intelligent behaviors in modules WRT external objects/modules
by GrandFather (Saint) on Feb 21, 2006 at 06:37 UTC | |
|
Re: Question about creating intelligent behaviors in modules WRT external objects/modules
by diotalevi (Canon) on Feb 21, 2006 at 06:25 UTC | |
|
Re: Question about creating intelligent behaviors in modules WRT external objects/modules (factor)
by tye (Sage) on Feb 21, 2006 at 07:21 UTC |