you already got good replies: yes you may need to adjust paths in the form (but as stevieb said c:/path/to is ok within windows) and for their content ( /opt does not exists at all on windows).
To make the program more portable I suggest you to use the core module File::Spec and all it's utilities: it'sa bit machinery to put in but very good choice in the long term.
Basically you must abstract the filling of every absolute path you intend to use, in the beginning of the program, then use them freely and safely. Using your example:
use strict; use warnings; use File::Spec; .. my @prog_dirs; # directory to find the program, still empty if ($^O eq 'MSWin32'){ @prog_dirs = qw(c: Programs devOps tools logs) } elsif $^O eq 'Linux'){ @prog_dirs = qw( opt devOps tools logs) } else{...} my $sqlLog = File::Spec->catfile( @prog_dirs, 'squirrel-sql-'.$creatio +nTime.'.log');
PS from the same module File::Spec->file_name_is_absolute File::Spec->rel2abs methods are very useful: everytime transform your paths into absolute ones!
L*
In reply to Re: script running on linux but not windows -- File::Spec
by Discipulus
in thread script running on linux but not windows
by thadc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |