in reply to Managing Architecture-Dependant Perl Modules in an Object-Oriented Hierarchy
That said, the Perl compiler will optimize away code paths that it can't possibly reach, like the following:
while (0) { for (1 .. 1000000000) {} }
Provided you have some sort of flag to mark sections of code as irrelevant to the current architecture, I think you'll be okay. (The disclaimer is that I haven't tried this in a while.)
If I were doing this, I would write wrapper classes, as you suggest. This'll provide one consistent interface for your main module to use. Your wrappers can take care of massaging the divergencies.
I'd write a tiny setup script that has the arch-dependent code in it, to check $^O and initialize the appropriate wrapper (which initializes the arch-dependent module). Then pass that wrapper instance into the constructor of the main module.
That leaves your main module relatively clean, and puts the nasty stuff away elsewhere where you don't have to work around it when you're more concerned about the business rules in your main module.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Why Win32::Internet (Re: Managing Architecture-Dependant Perl Modules in an Object-Oriented Hierarchy)
by tye (Sage) on Sep 21, 2000 at 20:20 UTC | |
by tilly (Archbishop) on Sep 22, 2000 at 06:29 UTC |