Gary Yang schrieb:
> Hi All,
>  
> I need to port my Perl script from Unix to Windows. Can someone tell me 
> how to figure out which platform I am on? i.e. I need to know which Perl 
> command can help me determin the platform. Once I know the 
> platform, I'll code my script as the example bellow. But, how to figure 
> out I am on Windows or Unix?

None of you questions are in any way related to this library.
They should be asked at your local perl support group.

$usingUNIX = ^O ne 'MSWin32';

> if ($usingUNIX)
>     {
>     $directory = `ls`;   #UNIX version.
>     $copyCommand = `cp`;   #UNIX version.
>     }
> else
>     {
>     $directory = `dir`;  #Win32 version.
>     $copyCommand = `COPY`;  #Win32 version.
>     }

Use the MakeMaker utils instead:

   perl -MExtUtils::Command -e mv source... destination
   perl -MExtUtils::Command -e cp source... destination

`ls` is usually done via glob() or readdir() / use DirHandle.

> Second question:
> The UNIX #!/usr/bin/perl notation does not work with Perl scripts on 
> Windows. How should I code if it is Unix I place "#!/usr/bin/perl" at 
> the very first line of the script? But, I do not place it at the first 
> line of code if it is not Unix? How should I do it?

The unix she-bang works ok on windows if your perl is in the path.

#! perl
is usually used, though the official way is to go through pl2bat for the 
windows version.

> Your answers are greatly appreciated.
> Thanks,
> Gary
-- 
Reini Urban
http://phpwiki.org/  http://murbreak.at/
http://helsinki.at/  http://spacemovie.mur.at/

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Perl-Win32-GUI-Users mailing list
Perl-Win32-GUI-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users
http://perl-win32-gui.sourceforge.net/

Reply via email to