RhetTbull has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; use warnings; if ($^O eq 'MSWin32') { eval q( require module1; import module1; sub bar { print "Win32\n"; } ); } else { eval q( require module2; import module2; sub bar {print "not Win32\n"; } ); } #later in the program... #we don't care what OS is running -- implementation details are hidden bar();
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Runtime module use and sub definitions
by chromatic (Archbishop) on Apr 03, 2002 at 20:48 UTC | |
by RhetTbull (Curate) on Apr 03, 2002 at 21:21 UTC | |
by perrin (Chancellor) on Apr 03, 2002 at 23:24 UTC | |
Re: Runtime module use and sub definitions
by CukiMnstr (Deacon) on Apr 03, 2002 at 21:32 UTC | |
Re: Runtime module use and sub definitions
by Desdinova (Friar) on Apr 03, 2002 at 21:23 UTC | |
by perrin (Chancellor) on Apr 03, 2002 at 23:22 UTC | |
Re: Runtime module use and sub definitions
by derby (Abbot) on Apr 03, 2002 at 20:47 UTC | |
Re: Runtime module use and sub definitions
by gregorovius (Friar) on Apr 04, 2002 at 16:53 UTC |