Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

my perl program executes, then closes in windows

Status
Not open for further replies.

spewn

Programmer
May 7, 2001
1,034
i still have yet to figure out how to run cgi's on windows, the many answers were a little above my head, (technical jargon that was used) and have reserved that battle for another day...

but, i can run perl on the computer, and when i create a program in perl and run it, it runs good then closes before i can even read all of it. help.

ex. i created our hello.pl, run it, can see it works, but then the box closes. how do i keep it open?

-crispy
 
Rather than execute your perl program from within Windows Explorer, exit to a command prompt then run your program. To do this, go to your start menu, select "Run" and type "command" in the Open field. Click "OK" and you should have a black screen come up with a line that looks like:

C:\WINDOWS\DESKTOP>

From here, you can use the cd command to move to the directory your script is in using the following syntax:

cd \path\to\perl\script

Where the "\"'s seperate subfolders. If a particular folder you're trying to enter has a long name (more than eight characters) or spaces, replace the name with the first six letters (no spaces) then a tilde (~) along with a number based on how many other folders have the first six characters in common (usually 1). For instance, to change into the "Program Files" directory, you would use:

cd \progra~1

Once you're in the appropriate directory, simply type perl yourscript.pl and everything that's displayed will remain on the screen.

Oh, and if you don't want to worry about traversing directories with "CD", you can just put save your scripts to the Windows desktop, and when you go to the command shell, you'll be in the appropriate directory.

Hope this helps,

brendanc@icehouse.net
 
Another way to avoid the closing window is to create a shortcut for the Perl program.

Create shortcut for Perl program
Adjust properties of shortcut so target is
C:\winnt\system32\cmd.exe /k "full_program_name"

For instance, say hello.pl was in C:\Perl\hello.pl
Target field would be: C:\winnt\system32\cmd.exe /k "C:\perl\hello.pl"

Note that you may need to adjust your path to cmd.exe. Just do a find for "cmd.exe" to figure out the path.

 
i'm so excited about the response time around here!

ok, got it going...

one more thing, once i create the perl program, i save it as .pl, and then run it. it has errors. how do i get back into the code itself to fix? i try to open the file, it simply runs it.

-crisp
 
Open your editor and use the editor's File/Open command to open your .pl file. Tracy Dryden
tracy@bydisn.com

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard.
 
The easiest way is to start your favorite editor and then open the file from the editor.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top