Gossamer Forum
Home : General : Perl Programming :

running perl locally

Quote Reply
running perl locally
Could some one help me? I want to install perl on my machine so that I can run and modify the links script before I post it to the net. Is there anything special I need to do? I have downloaded activeperl from a link I got from a post by Alex on a similar topic. Now what do I need to do? Just change the path to perl in the script to where it is located on my machine? chmod() is not required? Any help would be useful as I know some of you must be doing what I want to do.

------------------
Quote Reply
Re: running perl locally In reply to
Hi Ian,

Have you downloaded a webserver as well? If not, you'll need to download one. I use Apache, and you can get that from www.apache.org , but there are other Win32 webservers such as Xitami and Microsoft Personal Server *spit*. Smile I just like Apache because I can replicate the setup on my remote server.

When you have both, you just install them, and you're ready to go. Just make sure when you're installing Activestate Perl that it doesn't create file association (it does this by default in the setup), otherwise running a Perl script will open it in an MS-DOS window.

There's no need to worry about chmod or anything like that, Win32 doesn't need it.

If you run across any problems, just post here and someone will try and help you out.

Cheers,
adam

[This message has been edited by dahamsta (edited May 20, 1999).]
Quote Reply
Re: running perl locally In reply to
Thank dahamsta for your help.

I Am running windows 98 and plan on using the PWS (personal web server) from Microsoft. Its already on my machine and I dont want to take up to much more valuable disk space unless it is neccasary. Do you recomend I not use Microsoft PWS?

>Just make sure when you're installing >Activestate Perl that it doesn't create >file association (it does this by default >in the setup), otherwise running a Perl >script will open it in an MS-DOS window.

Hmm I just went along with the setup for the activestate perl, clicking next seemed to be the best idea considering I didnt know what I was doing. Should I reinstall?

And lastly using a script what do I use for my path to perl? Just like this?

#d:/perl

d is the drive I installed to and perl is the folder it created.

Thanks again for your help


------------------
Ian Galloway
www.gallowaysnet.com

"I love the "swooshing" sound deadlines make as they go by"

Quote Reply
Re: running perl locally In reply to
On my system, I use this at the top of my scripts:

#!F:/Perl/bin/perl

So, for your's, it would probably be:

#!D:/Perl/bin/perl

No need to worry about using / instead of \. Perl understands both.

I hope this helps.
Quote Reply
Re: running perl locally In reply to
 
Quote:
I Am running windows 98 and plan on using the PWS (personal web server) from Microsoft. Its already on my machine and I dont want to take up to much more valuable disk space unless it is neccasary. Do you recomend I not use Microsoft PWS?

Nah, I'm just fond of Apache because, as I said, I can replicate my remote server setup almost exactly. And I'm not fond of Microsoft Internet products, because, well, I find them buggy. It's entirely up to you what you use, everyone's needs differ.

Quote:
Hmm I just went along with the setup for the activestate perl, clicking next seemed to be the best idea considering I didnt know what I was doing. Should I reinstall?

Lemme put it this way, if it ain't broke, don't fix it! Smile You shouldn't be able to do any harm even if it's configured wrong. But if you find that when you try and follow a link and it pops up in an MS-DOS window, there's your problem. You jusy have to go into Explorer > View > Folder Options > File Types and remove the associations for CGI and PL files. See if it works first.

Quote:
And lastly using a script what do I use for my path to perl?

Well, I've tried Bobsie's version and it doesn't work on my system for some reason. I use the path to the exectuable Perl file, which in my case is:

#!/perl/bin/perl.exe

I'm not sure how PWS works, just keep trying possible combinations until you get it to work.

Good luck!

adam
Quote Reply
Re: running perl locally In reply to
It works for me, as well, as just #!/perl/bin/perl.

However, I uninstalled the version I was using and installed the lastest build of ActiveState Perl. Even though I specified not to associate, I still get perl running in a DOS window, even when I use the Start|Run command. How do I change that or can I?
Quote Reply
Re: running perl locally In reply to
Hiya Bobsie,

This is for Win95, I'm not sure about anything else. Fire up Explorer and follow me:

Explorer > View > Folder Options > File Types

Look for "PL File" or "CGI file", whichever is appropriate. It might be Perl file or something else, but on my build of Activestate, which is quite recent, dem's um as the fella said.

The simplest path from here is to just click on it and click remove, but just in case, it might be best to open it up and write down everything.

Hope that gets you sorted,
adam
Quote Reply
Re: running perl locally In reply to
I am using Windows95. I went through all the file types, one by one, and the only thing I could find was an association for .cgi, which I removed.

Then I ran the command, perl f:\test.pl, and it ran in a DOS window. There is no association for .pl in the file types. Why would it do that?
Quote Reply
Re: running perl locally In reply to
Thanks for all your help Bobsie and dahamsta but of course I still cant get perl scripts to run. I removed all the file associations like dahamsta mentioned but now nothing opens the script? Any suggestions?


------------------
Ian Galloway
www.gallowaysnet.com

"I love the "swooshing" sound deadlines make as they go by"

Quote Reply
Re: running perl locally In reply to
If your path to perl is correct, all you should need to do is type the command, "perl whatever.pl" (without the quotes) and it should run, provided the path to Perl/bin is in the system path.

Check your autoexec.bat file to see if it includes this line:

Quote:
SET PATH=Drive:\PERL\BIN;%PATH%

Where "Drive" is the drive letter where Perl is installed.

I hope this helps.

[This message has been edited by Bobsie (edited May 21, 1999).]
Quote Reply
Re: running perl locally In reply to
Bobsie,

Quote:
Then I ran the command, perl f:\test.pl, and it ran in a DOS window. There is no association for .pl in the file types. Why would it do that?

This is because by saying "perl f:\test.pl", you're telling MS-DOS to use Perl to run that script.

Ian,

Quote:
Thanks for all your help Bobsie and dahamsta but of course I still cant get perl scripts to run. I removed all the file associations like dahamsta mentioned but now nothing opens the script? Any suggestions?

How do you mean "nothing opens the script"? I'm under the impression that you think you can double-click on the script to run it in your browser, yes? If you want the script to run like on your webserver, you have to fire up the server you installed and call the script like you normally would, with a URL, using "localhost" as the domain name. If you want to run it just to check the output as text in an MS-DOS window, you have to set the association to Perl again.

adam
Quote Reply
Re: running perl locally In reply to
Adam,

Quote:
This is because by saying "perl f:\test.pl", you're telling MS-DOS to use Perl to run that script.

I don't follow that. I am executing the command from the Windows Run box in the Start menu. However, Windows is seeing Perl as a DOS program, not a Windows program, thus I get the DOS window. Since there is no association present, I know of no other way to specify to Perl what I want to run (outside of the browser). In an earlier message in this thread, you said:

Quote:
Just make sure when you're installing Activestate Perl that it doesn't create file association (it does this by default in the setup), otherwise running a Perl script will open it in an MS-DOS window.

So how do I get Perl to run in a normal Windows95 window instead of a DOS window? Or did I misinterpret what you said? If I cannot do that, then there was no purpose in removing the associations since the scripts ran fine in my browser when my localhost (Apache) was active and in the DOS windows if I wasn't using the browser. I just detest using the DOS windows because they always close when the script is finished executing before I can read any of the messages (normal or error messages). I had to write a doperl.bat file to put a pause and exit command in it in order to stop the window from closing but that absolutely assures the use of a DOS window which I really want to eliminate.
Quote Reply
Re: running perl locally In reply to
Hiya Bobsie,

I'm really not sure what you're trying to do, but I get the impression you want to run Perl as a program in Windows, which it can't do because all it is really is an interpreter. AFAIK, Perl doesn't have a Windows GUI, and you work with it from the command line (i.e. DOS) the same as you work with it from the command line in Unix.

The reason I advised that people remove or deny the file associations is that because when I installed Perl originally, it created the file extensions and when I tried running a Perl script from my browser it popped an MS-DOS window which, as you said, returned the result and closed again.

If you *did* want to run a perl script in MS-DOS to see the result it delivers, you can just run your script by opening an MS-DOS window manually and running it, it shouldn't shut down when it's done, it'll just return to the prompt.

Running "perl drive:\path\to\script.cgi" from the Run box does the exact same thing as typing it from the command line in MS-DOS, because the Run dialogue is just a pretty interface to the command line. And the reason it doesn't need a file association is because you're making an association when you use "perl" in the command line. You're telling it to use Perl to run the file.

I'm sorry if I misled you with all my talk, I'm no systems expert, I was just trying to help Ian get Perl up and running. Maybe you should explain exactly what it is you want to do, and some systems whiz will be able to help.

adam

[This message has been edited by dahamsta (edited May 22, 1999).]
Quote Reply
Re: running perl locally In reply to
Adam,

Okay, I got it now. Perl, when executed, always runs in a DOS window (too bad). Since I never had a problem with my browser opening a DOS window when I had both .cgi and .pl associated with Perl (my Apache server and Perl are configured to allow the browser to handle those scripts correctly), I guess I will put the associations back in just to make things a bit easier. I thought you were saying that it could run in a Win95 window without them, and I never could get it to do it. A misunderstanding on my part of what you were saying.

Thanks for all help and patience.
Quote Reply
Re: running perl locally In reply to
No problem. And if it helps any, I find it can be a boon to set the file associations for PL and CGI files to Wordpad or something similar. That way you just double click 'em and they pop up for editing, rather than you having to open an editor and open them from that.

Have fun.

adam