Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to add pause in Perl?

Posted on 2006-07-11
7
Medium Priority
?
10,838 Views
Last Modified: 2012-06-22
Hi.
I converted my perl script to EXE usng perl2exe. Now when I double click on my exe it runs great. I am also printing error messages in that. But as soon as the execution gets over , the window shuts down. How can I give some time of pause , so I can see the error messages while executing the script?
0
Comment
Question by:niravdesai23
7 Comments
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 17086240
Use the sleep command to specify how many seconds to wait for.
sleep(5);   # do nothing for 5 seconds
0
 
LVL 8

Expert Comment

by:Perl_Diver
ID: 17086551
You can maybe add a prompt for some user input at the end of the script (after all the output is generated and displayed) so the winodw does not close until you direct it to close. Or try using sleep() and see if it works OK.
0
 
LVL 2

Expert Comment

by:alexsergeyev
ID: 17088848
Effective way to make "unblocking" pauses is "alrm" function with SIGALRM handler.
more - "perldoc alrm" and "perldoc perlipc"
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 39

Expert Comment

by:Adam314
ID: 17090498
Or if you start your program from a command prompt (instead of double-clicking an icon), the window won't close, and you'll be able to see the error messages.
0
 
LVL 39

Expert Comment

by:Adam314
ID: 17090505
Or you could redirect the output to a file, which you could then view in any text editor, using this syntax:

program.exe > output.txt
0
 
LVL 2

Accepted Solution

by:
Linky earned 400 total points
ID: 17094346
You can do:

system("pause");

It will say, "Press Any Key to Continue . . ."

0
 

Expert Comment

by:tong111797
ID: 28877370
print "Press Any Key to Continue . . .";
getc(STDIN);
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have been pestered over the years to produce and distribute regular data extracts, and often the request have explicitly requested the data be emailed as an Excel attachement; specifically Excel, as it appears: CSV files confuse (no Red or Green h…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question