inline.

Tom Arnall


On Thursday 22 June 2006 06:35 pm, Tom Phoenix wrote:
> On 6/22/06, tom arnall <[EMAIL PROTECTED]> wrote:
> > invoking a perl script with '#!/usr/perl -wd' in its first line and
> > with  './myscript >t' on the command line,
>
> What are you trying to do? 

i want to enable the user to select either a file or STDOUT for output, the 
way one uses e.g. 'cat'. but, as you say, this confuses the debugger. i can't 
see any alternative, except to get the file name via ARGV and use 'select' to 
enable output to STDOUT when, say, the user fails to supply a file name on 
the command line. other ideas welcomed. thanks btw for the help you give to 
the Perl community.


The output redirection is confusing to the
> debugger. If you're trying to make a transcript of your debugger
> session, there's probably a better way to do that. If you're trying
> debug a program and send its default output to a file, you can do that
> from within the program, for example in a BEGIN block:
>
>   open DEBUG_OUT, ">./t" or die "Can't open file 't' for output: $!";
>   select DEBUG_OUT;  # now the default for print and printf
>
> Alternatively, you should even be able to do the same thing from
> within the debugger, by typing those two lines into the debugger as
> the first two commands before the rest of your program starts running.
>
> Does that work for you? Good luck with it!
>
> --Tom Phoenix
> Stonehenge Perl Training




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to