
japhy
Enthusiast
Jul 21, 2000, 4:58 AM
Post #4 of 7
(809 views)
|
|
Re: Cross platform perl module
[In reply to]
|
Can't Post
|
|
The basic idea is to make your program as portable as possible. Windows can handle forward slashes in file paths (try it). And don't call the system if you can survive without it. Don't call 'rm' or 'del', use Perl's unlink() function. That's why it's there. Don't call 'ls' or 'dir', use opendir and readdir and closedir. That's why they're there. And if you have to call the system, wrap it with a $^O test: <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> if ($^O =~ /win/i) { windows_system_call(); } elsif ($^O =~ /mac/i) { mac_system_call(); } ... </pre><HR></BLOCKQUOTE> ------------------ Jeff "japhy" Pinyan -- accomplished author, consultant, hacker, and teacher
|