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

Dear All, I just installed Mandriva 2006, and one strange change is that in order to execute a perl script, I have to type on the cmd: perl programName (like in Win) instead of just the programName. Is that normal???? Thank you all for your responses.

The error message I'm getting when I try to execute the script without preceding the scriptname by perl (as it normally should be on Linux) is as follows:

bash: programName: command not found


Of course if I precise perl before programName, the script is normally executed. My guess is that Mandriva 2006 doesn't allow execution of arbitrary files, I don't understand why they made this change.

I tried the free support service, but didn't get any answers there so far.


I just want to be sure that it is not something I can configure myself.

Thanks, Rémi

Replies are listed 'Best First'.
Re: perl execution on Mandriva2006
by McDarren (Abbot) on May 17, 2006 at 06:56 UTC
    Unless the directory where your Perl script resides is in your environment path variable, you have to supply the full path to the script. Which might be something like /home/ramgi/myscript.pl, or simply ./myscript.pl if you are already in that directory.

    You also need to make sure that the script is executable. (chmod 0755 myscript.pl - if you want it to be executable by all)

Re: perl execution on Mandriva2006
by Anonymous Monk on May 17, 2006 at 15:33 UTC

    Could it be that the '#!' line at the top of your
    program is no longer pointing at the perl executable?

Re: perl execution on Mandriva2006
by Random_Walk (Prior) on May 17, 2006 at 16:24 UTC

    if you look at the #! line at the top of your perl script this will show you where the OS will go looking for the executable to run that script. /usr/bin/perl is the usual location in Mandriva. If you have a lot of scripts with another location, say /bin/perl you could make a link from there to your script or you can feed your scripts through a onle liner to change it, something like this would do all the ones in your current dir.

    perl -pe 's|#!/bin/perl|#!/usr/bin/perl|' *.pl

    On a seperate note does anyone know why Mandriva ship a perl without multithreading compiled in ? If I try perl -Mthreads -e1 I get an error informing me it is not compiled for multithread. Is there any sane reason for Mandriva to do this ?

    Cheers,
    R.

    Pereant, qui ante nos nostra dixerunt!
Re: perl execution on Mandriva2006
by Crackers2 (Parson) on May 17, 2006 at 16:48 UTC

    A user having the same problem not too long ago said that in his case was that SELinux was configured not to allow execution of arbitrary files. Perhaps Mandriva has the same restricted setup?

    (It would have helped if you could have included the exact error message you get)