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
In reply to Cross-Platform code by GhodMode
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |