Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

ActivePerl

by indapa (Monk)
on Dec 10, 2000 at 09:41 UTC ( #45921=perlquestion: print w/replies, xml ) Need Help??

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

I am a newcomer to Perl and recently downloaded ActivePerl for my PC. I tried running a sample test script that came with the download. When I typed: perl example.pl on my command line DOS prompt I get a bad command or file name response. So the installation didn't add Perl to my PATH variable correctly. I am not too familiar with DOS, but how do I set my PATH variable to include the directories where the Perl binaries are located. Thanks for the help.

Replies are listed 'Best First'.
Re: ActivePerl
by TStanley (Canon) on Dec 10, 2000 at 17:36 UTC
    If you are running Windows 95/98, you need to edit your
    autoexec.bat file to include the following line:


    PATH=C:\Perl\bin

    After you edit this file, you would then have to restart
    your machine. At that point, you should be all set.

    TStanley
    There can be only one!
Re: ActivePerl
by turnstep (Parson) on Dec 10, 2000 at 17:45 UTC
    It's probably just the case that you did not reboot. ActivePerl may have added the proper line to your AUTOEXEC.BAT file, but DOS windows will not get any of it's benefits until you reboot. You can also see if it is there by looking at the fie yourself. Go to Start->Run and enter WORDPAD C:\AUTOEXEC.BAT. Look for a line that starts with PATH and see if the word PERL is in there. It should be something like C:\PERL\BIN. If it *is* in there, you are all set, just reboot. If not, you will have to add it yourself. Find the directory that ActivePerl was installed into, and then make sure that it has a "BIN" directory under that. This is the directory that actually stores the PERL.EXE file, which is what your DOS windows could not find. (You can also do a "Find" for PERL.EXE to determine the correct directory)

    (Side note: you can type the full path to PERL.EXE or set a temporary path at the command line with PATH=%PATH%;C:\PERL\BIN if you do not wish to reboot yet.) At any rate, the paths (places to look for executable files) are separated by semicolons, so just add the path to perl at the end of the final PATH statement in your AUTOEXEC.BAT. In other words, if your AUTOEXEC.BAT looks ike this:

    @ECHO OFF DOSKEY /INSERT SET TZ=EST5EDT cls Echo Depressing kernel... PATH=C:\WINDOWS;C:\WINDOWS\COMMAND
    just change the last line to read:
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\PERL\BIN
    (or wherever ActivePerl has installed Perl. If you still can't find it, just do a Find on "PERL.EXE")
      Unfortunately, ActivePerl does not add the path to the autoexec.bat file.
      I had to add it manually, and reboot my system, when I installed it on my
      home PC.

      TStanley
      There can be only one!
        On NT, it automatically modifies the system environment (I guess this is stored in the registry or something). You can see this by right-clicking on My Computer, selecting Properties, and selecting the Environment tab. I don't know if Win9x has something similar or not, but it seems strange that the installation would skip something like this. Indeed, the release notes indicate that somehow, it should be adding this information to the PATH. Under Win9x, I wonder if this cannot be done via the registry as well...
Re: ActivePerl
by Fastolfe (Vicar) on Dec 10, 2000 at 09:45 UTC
    Firstly, this probably doesn't belong in this section. Secondly, the ActivePerl installer from ActiveState should have done all of this for you. Did you install Perl in some strange way?

    You may have better luck checking the support section of ActiveState's web site for installation issues. You may just have to edit your autoexec.bat (or change the Environment section under My Computer/Properties) to add the Perl bin directory to your PATH. But if that's missing, chances are other parts of your Perl installation may not be done correctly. I suggest you go with the recommended installation procedures documented on ActiveState's web site. If you did, and are getting this error, perhaps this is a bug in the ActiveState installation. Either way, I'd check their support site.

    Hope this helps.

Re: ActivePerl
by Albannach (Prior) on Dec 10, 2000 at 09:48 UTC
    You didn't tell us your flavour of Microsoft OS, but my guess is it's Win95/98 (later confirmed in the Chatterbox), and if that's the case you simply can't get the OS to understand "foo.pl" as an executable file. You could try 4DOS (or whatever they call the Win32 version) as it should add the capability, otherwise get WinNT or Win2k (or a UN*X variant, but I've got to work under NT and you can too ;-).

    Until then, run your scripts like C:\perl foo.pl

    --
    I'd like to be able to assign to an luser

Re: ActivePerl
by mrmick (Curate) on Dec 10, 2000 at 09:49 UTC
    If you're trying to run it on WIN95/98 you'll have to run the example.pl as :
    perl example.pl
    On NT it will run without the 'perl' since it already knows that the .pl extension is to be run by perl.

    Mick
Re: ActivePerl
by munchie (Monk) on Apr 27, 2002 at 15:45 UTC
    This may seem like an obvious solution, but make sure you cd (change directory) to the directory that the script is located, then you can simply use perl example.pl, and it will work fine.

    -munchie
    Look ma! I'm on CPAN!

    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2019-12-09 12:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?