GhodMode has asked for the wisdom of the Perl Monks concerning the following question:
I am developing a Web application on my Linux server at home that needs to work in two different environments: Linux based Web server with a commercial hosting provider & Windows XP on an intranet.
My development server and the Windows computer are both running xampp and the real Web server is running a real LAMP configuration.
I would like to write code so that I can copy it from one machine to the other without having to change anything.
As it is, I have to change the #! line for all of the Perl programs and I don't think I'll be able to avoid that. The other stuff, though, is all related to directories and file locations. This includes a use lib line for a module I wrote for this specific project.
For example, I would like something that works like this:
I know that the use lib line will be tricker, but is it possible if I put it in a BEGIN block? Does anyone have some advice on how to do this stuff? Thank you,if ( $linux ) { $logdir = "/home/ghodmode/logs"; $sep = "/"; } elsif ( $windows ) { $logdir = "c:\\xampp\\xampp\\webapp\\logs"; $sep = "\\"; } $logfile = "$logdir${sep}error_log.txt";
-- -- GhodMode
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Cross-Platform code
by ikegami (Patriarch) on Feb 06, 2006 at 00:46 UTC | |
by wolv (Pilgrim) on Feb 06, 2006 at 10:03 UTC | |
|
Re: Cross-Platform code
by rhesa (Vicar) on Feb 06, 2006 at 00:47 UTC | |
|
Re: Cross-Platform code
by GhodMode (Pilgrim) on Feb 06, 2006 at 01:38 UTC | |
|
Re: Cross-Platform code
by rinceWind (Monsignor) on Feb 06, 2006 at 09:00 UTC | |
|
Re: Cross-Platform code
by helphand (Pilgrim) on Feb 06, 2006 at 01:02 UTC | |
|
Re: Cross-Platform code
by GhodMode (Pilgrim) on Feb 06, 2006 at 01:58 UTC | |
by acid06 (Friar) on Feb 06, 2006 at 03:15 UTC | |
by GhodMode (Pilgrim) on Feb 06, 2006 at 03:23 UTC | |
by glasswalk3r (Friar) on Feb 06, 2006 at 18:28 UTC |