On Tue, 21 May 2002, Amir Karger wrote:

> On Tue, May 21, 2002 at 10:21:35PM -0400, Carl Jolley wrote:
> > On Tue, 21 May 2002, Abner, Daniel wrote:
> >
> > > >Incidentally, 2> redirects don't really seem to work. When I try them, I
> > > >tend to get stdout going to the redirect file, and stderr still going to
> > > >stdout.
> > >
> > > You can redirect like this:
> > >
> > > $rc = `dir /S 2>&1`;
> >
> > Only if the shell for the system you are running on supports the
> > 2 file descriptor. Some shells (or at least one) don't because the
> > underlying OS philosophy is "if there are errors you should always
> > see them on the console because otherwise you might get confused".
>
> In particular:
>
>
>     D:\Amir\Perl>perl -e "print 'hi';print STDERR 'blah'" > foo 2>&1
>     blah
>     D:\Amir\Perl>more &1
>
>     hi
>     D:\Amir\Perl>
>
>
> This is really depressing.
>
> Hm. The ActiveState list says you can do "close STDERR; open STDERR,
> '>blah'". Hmmm.
>

In particular, I've often encountered the problem with a perl compile
when an error ocurred early in the script that cause mutiple errors
to be produced to the entent that the original error that cause all
the messages was no visible on the console due to the fact that the
console can only show a finite number of lines, typically 24.

By opening STDERR in a BEGIN block I can capture all of perl's syntax
errors to STDERR in a file that I can then page through with "more" or
"less" or any other test eiditor that I choose.

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to