CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
command prompt

 



wikeyrx
New User

Dec 9, 2008, 6:44 AM

Post #1 of 3 (344 views)
command prompt Can't Post

Hi,

I have a script that I run in Window with ActivePerl installed. This script basically goes to a network drive and load the file up and search for a string. I run it by doubleclicking .pl file. This runs fine and the command prompt window pops up and I'm able to input the paramater I want to search for. However, if for any reason this file is unreachable you can see the cmd window disappear without any errors. How can I have the cmd stay up so the user can see the error msg? If I run this script in cmd then obviously the error is display but again, I would like to just run the script by double clicking the icon? Any help is apperciated.

This is what I have below.

$wlog = '../wrapper.log';
open(INFO, $wlog) or die("Could not open log file. $!");
@lines=<INFO>;
close(INFO);

Thanks,


KevinR
Veteran


Dec 9, 2008, 9:04 AM

Post #2 of 3 (340 views)
Re: [wikeyrx] command prompt [In reply to] Can't Post

Might be better ways but here is a suggestion:


Code
open(INFO, $wlog) or error("Could not open log file. $!"); 
....
....


sub error {
print "$_[0]\n";
sleep(10);
exit(0);
}


You might want to look through the activeperl documentation and search for specific Windows methods of running your perl programs. I would think activeperl has a builtin method that keeps a window open.
-------------------------------------------------


wikeyrx
New User

Dec 9, 2008, 9:38 AM

Post #3 of 3 (338 views)
Re: [wikeyrx] command prompt [In reply to] Can't Post

Thanks Kevin,

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives