Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 16th, 2006, 6:50 PM   #1
mammothfan
Newbie
 
Join Date: May 2006
Location: Denver, Colorado
Posts: 8
Rep Power: 0 mammothfan is on a distinguished road
system "PAUSE";

hello. I have some basic experience in c/c++, but when it comesto perl I am a newb.I was wondering if experienced perl programmers object to using system "PAUSE"; at the end of their programs to eliminate having to run them from a command line. Thnx in advance
mammothfan is offline   Reply With Quote
Old Oct 16th, 2006, 7:25 PM   #2
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Yes. A huge chunk (I'd say over 95%) of Perl code is run on *nix systems, where no such pause command is available. You could try using getc:
print "pausing...\n";
getc();
Which generates the effect you want, but since I don't do Perl all that much, I don't know offhand if there's a better way. There probably is.
niteice is offline   Reply With Quote
Old Oct 16th, 2006, 7:48 PM   #3
mammothfan
Newbie
 
Join Date: May 2006
Location: Denver, Colorado
Posts: 8
Rep Power: 0 mammothfan is on a distinguished road
Is that like getchar() in C? if so, if you use that to get a char will it seice to be able to pause the program like in C? Also, what is nix*?
mammothfan is offline   Reply With Quote
Old Oct 16th, 2006, 8:30 PM   #4
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Yes, it does the same thing as getchar() - waits until a character is input, and then returns it.

*nix collectively refers to Unix, Linux, Mac OS X, every OS considered Unix-like - so almost everything but Windows.
niteice is offline   Reply With Quote
Old Oct 16th, 2006, 9:05 PM   #5
mammothfan
Newbie
 
Join Date: May 2006
Location: Denver, Colorado
Posts: 8
Rep Power: 0 mammothfan is on a distinguished road
I see
mammothfan is offline   Reply With Quote
Old Oct 16th, 2006, 10:47 PM   #6
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 319
Rep Power: 4 andro is on a distinguished road
Send a message via AIM to andro
Quote:
Originally Posted by niteice View Post
...so almost everything but Windows.
I wouldn't be that generous...
andro is offline   Reply With Quote
Old Oct 17th, 2006, 10:21 AM   #7
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
Originally Posted by niteice View Post
Yes. A huge chunk (I'd say over 95%) of Perl code is run on *nix systems, where no such pause command is available. You could try using getc:
print "pausing...\n";
getc();
Which generates the effect you want, but since I don't do Perl all that much, I don't know offhand if there's a better way. There probably is.
i beg to differ. *nix, has such a command. It's called sleep. You maye fine more info about the sleep command, Here
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Oct 17th, 2006, 11:58 AM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Originally Posted by andro
Quote:
Originally Posted by niteice
...so almost everything but Windows.
I wouldn't be that generous...
Amazing that the tip of the iceberg is viewed as the world, nesty paw? (My best French.)
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Oct 17th, 2006, 4:41 PM   #9
niteice
Programmer
 
niteice's Avatar
 
Join Date: Aug 2005
Posts: 98
Rep Power: 4 niteice is on a distinguished road
Send a message via AIM to niteice
Quote:
Originally Posted by Pizentios View Post
i beg to differ. *nix, has such a command. It's called sleep. You maye fine more info about the sleep command, Here
D'oh! That works too, but he's only looking for a way to pause until user input, not for a certain amount of time.
niteice is offline   Reply With Quote
Old Oct 17th, 2006, 5:00 PM   #10
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
Quote:
Originally Posted by niteice View Post
D'oh! That works too, but he's only looking for a way to pause until user input, not for a certain amount of time.
From the perldoc page for sleep()

Quote:
Originally Posted by perldoc
Causes the script to sleep for EXPR seconds, or forever if no EXPR. May be interrupted if the process receives a signal such as SIGALRM
So if given no amount of seconds, the program will sit there until a interupt is sent. From the orginal posters comments, to me this gives the functionallity that he's looking for. He just wants the window the perl script runs in to not close after the script completes. This will work for what he described above.

BTW, usually the interupt on the systems is sent by hitting ctrl-c. However on SEO linux (and possabily on other linux systems, most should be setup as ctrl-c though) the interupt is tied to the delete key.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to meet these cross-platform project goals? mattengland C++ 1 Apr 3rd, 2006 5:01 AM
PHP system commands ktsirig PHP 6 Oct 4th, 2005 2:24 AM
Why shouldn't we use System(); Shapeless C++ 7 Jul 19th, 2005 7:10 AM
System Info Da-Kid C++ 9 Feb 15th, 2005 7:46 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:43 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC