Re: what is the difference between perl scripting in windows and linux
by FunkyMonk (Chancellor) on Aug 04, 2010 at 10:07 UTC
|
| [reply] |
Re: what is the difference between perl scripting in windows and linux
by cdarke (Prior) on Aug 04, 2010 at 09:53 UTC
|
Linux we can execute shell command, in windows it cannot
What is cmd.exe then, if it's not a shell? Ever heard of .bat files? Agreed, it's a pretty duff language, but that's not the same as 'cannot'. Seen Powershell? There are implementations of Bash and Korn shells that run on Windows, and you can download many of the command-line utilities from GNU for Windows. Major difference at the scripting level on Windows is the lack of #!, which really holds it back.
Forget about shell scripts, use Perl. It works well on both. | [reply] |
|
Major difference at the scripting level on Windows is the lack of #!
This is true, but I'd like to point out that on Windows, the switches will be processed although the path to Perl is ignored. eg #!/usr/bin/perl -w will turn on warnings, but the path part is meaningless.
| [reply] [d/l] |
|
Yup, but you can't count on that for other languages, like shells.
| [reply] |
Re: what is the difference between perl scripting in windows and linux
by shawnhcorey (Friar) on Aug 04, 2010 at 13:25 UTC
|
| [reply] [d/l] [select] |
|
Perl in Windows cannot fork(). I rarely use windows, and am a linux advocate, but Windows does allow a pseudo fork by creating a thread. The fork command will work on Window's versions of Perl, but there is hidden OS-specific magic.
The differences which I hassle with the most, is the line endings are different, requiring frequent dos2unix or unix2dos conversions. There is no easy to use IPC on pipes in Windows, so frequently used modules on linux, need special Win32 modules, like IPC::Run instead of the standard IPC::Open3. Also, Windows is done within the confines of a graphical GUI, wheras on linux, there is a true console, so you need to run wperl to suppress windows from opening. Finally, and the BIGGEST problem, there is the hassle of getting precompiled modules for the various versions of win32. Since you don't get an easy to use or install compiler with Windows, you need to rely on others to make many of the modules for you, and often they are hard to find.
Wheras on Linux, the instructions to build modules generally work flawlessly.
To be honest, Perl was designed to run on Linux and Unix platforms, and if
you want the most satisfaction from Perl, run it on Linux. Ubuntu is easy and the most Windows-like.... but I prefer Slackware, as it still adheres to the original simple unix style. But if you can't afford 100 hours to learn basic unix, then Ubuntu is great...it has the apt-get program to get you automatic updates, will connect to wireless access points automatically, and is supported for 5 years on each new release.
| [reply] |
|
Since you don't get an easy to use or install compiler with Windows
You are mistaken. There are *three* easy way to install a compiler.
- Strawberry Perl comes with a compiler.
- ActivePerl's cpan will automatically install a compiler if needed.
- You can install MS's compiler for free. It's a one-click install.
Finally, and the BIGGEST problem, there is the hassle of getting precompiled modules for the various versions of win32.
Quite the opposite, it's a great plus that you don't need to compile most modules yourself.
| [reply] [d/l] |
|
|
|
|
|
|
if you want the most satisfaction from Perl, run it on Linux
However, if you're working in a Windows-centric environment, Perl can be useful for management tasks and for interacting with installed programs. Sure there are alternatives (DOS, VBscripts, power shell, etc.), but I often times I prefer Perl.
Anyways, I'm not trying to pick sides in the Windows vs. *nix debate of which is better. Just wanted to point out that Perl in a predominately Windows environment can still be very useful and provide a lot of satisfaction.
I think it's best to know how to use multiple tools and grab the one that you think is best for the job. That's my 2 cents.
Despite what I typed above, I do have to admit that there are a number of built-in Perl functions that whose name/syntax/functionality are more *nix-like, which I admit supports your argument that "Perl was designed to run on Linux and Unix platforms".
| [reply] |
Re: what is the difference between perl scripting in windows and linux
by blakew (Monk) on Aug 04, 2010 at 18:26 UTC
|
Practically speaking you're going to want an environment with a CPAN client. While Strawberry Perl has made things leaps and bounds easier there's still the issue of whether CPAN modules install properly in all environments, and especially if they're not "pure-Perl" and/or depend on third-party libraries when building and linking; and if they do, how easy they make the install process. Not every module with these build issues releases an updated binary though for many you can find one in a ppm repository.
Update: Just saw it, see also ikegami's post. | [reply] |
Re: what is the difference between perl scripting in windows and linux
by SFLEX (Chaplain) on Aug 05, 2010 at 12:59 UTC
|
Linux has a Case Sensitive file system and windows does not. | [reply] |
|
| [reply] |
|
Let me explain, NTFS has always had the capability to support a case sensitive file system, but by default the registry setting in windows is always none case sensitive.
By changing the setting to case sensitive you will run into a large amount of problems where programs cant find files, shortcut links don't work, after updates the registry defaults back to none case sensitive and this will always happen when updating .NET.
So back to reality my answer of "Linux has a Case Sensitive file system and windows does not." is in fact true and if you look at that in the reverse try to turn Linux to a none case sensitive file system, then most will say to themselves "Why would you want to do that anyway?"
Linux chooses to be case sensitive and Windows does not.
| [reply] |
Re: what is the difference between perl scripting in windows and linux
by Anonymous Monk on Aug 05, 2010 at 12:22 UTC
|
Is it not so easy to list out, these all the differences between perl scripting in windows and Linux.
I have gone through this whole thread, but anyway am not able to summarize it like.. these following points are different in windows and linux.
I understand only an expert can do that, can somebody ? I would be very thankful for it.
| [reply] |
|
| [reply] |
|
You seem to want the answers to both the following questions:
What are the differences between perl on unix/linux and on Windows?
What are the differences between unix/linux and Windows?
The answer to the 1st question is answered in perl's own docs, but the major one is that fork() on Windows is implemented as threads.
The answer to the 2nd question is long and involved and frankly expecting someone to type 'em all out for you is abusive.
If you hope to write cross-platform code, avoid using external programs where you don't have to and use the many excellent modules built for the purpose.
| [reply] |