perl interpreter automatically exit windows so how I can saw the result of script?

G

Greg Bacon

: On Thu, 19 Aug 2004, Greg Bacon wrote:
:
: >I'd like to know of a workaround that would cause the window to
: >linger when there are syntax errors, a use fails, etc.
:
: Easy: make that END { ... } the first line of your code.

Did you test that suggestion?

Greg
 
D

Dave

A. Sinan Unur said:
Learn how to use Windows XP, why don't you?

Download the "Command Prompt Here" powertoy from Microsoft (google for it).

One can also add the same functionality provided by the powertoy simply
by importing the following into the registry:

--------------- Start copying here ---------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd]
@="Open Command Window Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Directory\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd]
@="Open Command Window Here"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Drive\shell\cmd\command]
@="cmd.exe /k \"cd %L\""

------------------- End of text ------------------

Note to OP: copy and paste the above text into a text file and rename it
so that it ends with a 'reg' extension; then double click on it.

Dave
 
J

Joe Smith

Jeff said:
Easy: make that END { ... } the first line of your code.

Nope, that doesn't work. END only works after INIT time, and that
does not happen on compile errors.

Putting CHECK{...} as the first line of code does handle
missing 'use' statements and compile errors, but may not show
all the error messages in the right order.
-Joe

C:\jms>perl -e "CHECK{system 'pause'}; use strict; print $bar"
Global symbol "$bar" requires explicit package name at -e line 1.
Execution of -e aborted due to compilation errors.
Press any key to continue . . .
Can't use string ("bar") as a SCALAR ref while "strict refs" in use at -e line 1.
 
B

Ben Morrow

Quoth Joe Smith said:
Nope, that doesn't work. END only works after INIT time, and that
does not happen on compile errors.

Catch $SIG{__DIE__}, perhaps? (untested)

BEGIN {
$SIG{__DIE__} = sub {
# fix bizarre calls to __DIE__ in evals
die @_ if $^S or $ENV{PROMPT};

warn @_;
system 'pause';
};
}

Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top