Many solutions -
Solution 1
Run it under the DOS prompt!
Solution 2
Add
sleep(5); to the end of your script to wait for 5 seconds, long enough for you to inspect its output, whether it has failed or not.
Solution 3
having STDERR persist in a visible form when the program is launched in this way
You could create a short-cut to your perl script, and modify the property of the shortcut to something like -
C:\Perl\bin\Perl.exe C:\Perl-examples\example.pl 2> C:\Perl-examples\e
+xample.log
Which will redirect your STDERR to a log file when you double click on the short-cut.
Solution 4
Capture stuff printed to STDERR in your program, and pause at the end if anything was printed to STDERR. The perl script will only pause when there is something printed to STDERR.
use IO::Capture::Stderr;
my $capture = IO::Capture::Stderr->new();
$capture->start(); # start captured
# your stuff here...
print STDERR "...\n"; # STDERR is captured
print "...\n"; # STDOUT is not captured
# at the end
$capture->stop(); # stop capture
my @err = $capture->read;
if ($#err >= 0) { # any captured error?
print "$_" for @err; # print stderr to screen
<STDIN>; # wait for input
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.