Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Need help to change from windows perl to linux perl

by muthuvel_perl (Initiate)
on Jun 21, 2005 at 07:43 UTC ( [id://468582]=perlquestion: print w/replies, xml ) Need Help??

muthuvel_perl has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,
Now i am working in windows perl platform.
But, I want to change to Linux based perl?. Please guide me for my updation.
Thanks in Advance Muthuvel

Replies are listed 'Best First'.
Re: Need help to change from windows perl to linux perl
by Zaxo (Archbishop) on Jun 21, 2005 at 07:52 UTC

    The main difference that you'll notice is that everything works as documented. Winders doesn't support some very useful unixisms like signals, select with four args, true process forks, and so on. What support Perl has for those in win32 is emulated - not always faithfully.

    See perlport and perlwin32 (reading sort of inverted) for information about platform dependencies.

    After Compline,
    Zaxo

Re: Need help to change from windows perl to linux perl
by jbrugger (Parson) on Jun 21, 2005 at 08:26 UTC
    It would be nice to know a bit of linux as well,
    what version will you be running? e.g. Debian, Redhat, Slackware are all linux distributions, but differ on packaging support.
    Most perl modules you need on debian for example, are best installed using apt-get, and not with the perl -MCPAN way.
    Next you have to know about the way linux handles userrights , not anyone can execute a script, if running apache, it would be nice to know about suexec.

    Then there is the newline, the path "/" in stead of "\", and the place perl is installed (probably /usr/bin/perl).
    Anyway, get to know linux first, before just taking this step

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.
Re: Need help to change from windows perl to linux perl
by uksza (Canon) on Jun 21, 2005 at 07:58 UTC
    remember about CRLF line terminators in winfiles:
    fromdos < win_perl.pl > lin_perl.pl

    uksza
Re: Need help to change from windows perl to linux perl
by mosh (Scribe) on Jun 21, 2005 at 08:42 UTC
    You have to convert your code by dos2unix program, one of its aims is to handle the CRLF.
    Search google for this program.

    Mosh.

Re: Need help to change from windows perl to linux perl
by rjsaulakh (Beadle) on Jun 21, 2005 at 09:20 UTC

    you just need to have perl installed in ur Linux machine . Perl is installed by default on linux with some standard packages . if you have more knowledge of perl as u have worked on windows u can select the modules reuqired by you at the time of installtion

    in linux box u can check ur version of perl by perl -V which gives u the version of perl and u can look for modules installed in @INC directory

    installing modules in perl is easier provided you have internet connectivity just type out
    perl -MCPAN -e shell
    on the command prompt and then install <module_name> will do the rest for you
    remember for installing perl modules u need to a root if not then u can see her http://www.perl.com/pub/a/2002/04/10/mod_perl.html

    Hope this helps you
    good luck using perl on linux

Re: Need help to change from windows perl to linux perl
by 2ge (Scribe) on Jun 21, 2005 at 07:51 UTC
    and what is problem ? Everything you have to is just install perl to your linux platform, and add to your scriptst at the beginning:

    #!/usr/bin/perl

    Better write what exact problems do you have.
Re: Need help to change from windows perl to linux perl
by monarch (Priest) on Jun 21, 2005 at 13:21 UTC
    Permissions!

    The biggest thing that gets me between the platforms has been the concept of permissions. As others have pointed out, you can't just type "something.pl" and press enter and expect it to run.. linux has no idea that .pl is anything significant. Hence the initial #!/usr/bin/perl line at the top of your program.

    But that's only half the story. The most important thing is setting the permissions of the file such that linux knows that the file is executable. You check the permissions of the files in your directory with ls -al and look for the x permission (meaning executable). If it's not there for your script you may want to change it using the chmod command (check the documentation by typing man chmod at the command line in linux).

Welcome 2 the JEDIes world!
by Anonymous Monk on Jun 21, 2005 at 16:32 UTC
    You are going to know perl's origins.

    You'll notice that not only perl uses shebangs at the starting of the script. This is because LINUX doesn't need to see the file extension to know the language of the script. Said so, you could put a perl script without the .pl extension at the bin/ directory and use it as your new and private command, for everyday use!

    You should read about BASH or the sh(ell) scripts that are cousins of perl, as well as awk and sed. After this, your perl is going to improve a lot. Perl appeared as a usefull way of simplifying these powerful commands. So, perl should do the same as all these. AWK is like a living REGEX scripting language. (ask Merlyn).

    You should know about chmod and chown since you are no longer at the kinder. This is a heavy weight, it runs most Internet servers. You are now working as if you where using a big MainFrame as NASA or PIXAR have. Machines shared by lots of people connected at big networks.

    So, the starting is a bit hard, but the reward is that you are going to finally become another guru. And what matters most, you are going to improve a lot your perl skills.

    Use the force, Luke!

        having recently taken that step myself, some up-to-date tips: - with debian, perl is all installed automatically and works out-of-the-box; - even if you're new to the unix world you can soon get the hang of file permissions, but the fun really starts with mysql: that caused me a lot of frustration - you have to change the file ownership (if they're pulled over from windows) to "mysql" as well; - tried kdevelop as DE for perl and got into a hopeless tangle: it's using a steamroller to crack a nut; - what I like a lot as my perl DE is SciTe (there's a deb package); there's just a problem under kde with the window frame font sizes (because it's gtk). The solution you'll find on the net of installing gtk2-engines-gtk-qt didn't work (at least the debian package). Scite wouldn't launch afterwards, and I had to deinstall gtk2-engines and delete a couple of *rc config files before it would run again. ..apart from that, all is sweetness and light (...well, most of the time) good luck.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://468582]
Approved by jbrugger
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2024-03-19 08:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found