For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > June 2006 > '-d' with '>' creates errors









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author '-d' with '>' creates errors
Tom Arnall

2006-06-24, 8:01 am


invoking a perl script with '#!/usr/perl -wd' in its first line and
with './myscript >t' on the command line, i get as below. i have done this
kind of thing many times, but never with this result. also, the script runs
fine if i drop '>t' from the invocation, or drop '-d' from the first line of
the script.

========================================

$ ./myscript >t

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(./myscript:12): ;
Unable to get Terminal Size. The TIOCGWINSZ ioctl didn't work. The COLUMNS and
LINES environment variables didn't work. The resize program didn't work.
at /usr/lib/perl5/Term/ReadKey.pm line 343.
Compilation failed in require at /usr/share/perl5/Term/ReadLine/Perl.pm line
58.
at /usr/share/perl5/Term/ReadLine/Perl.pm line 58

Term::ReadLine::Perl::new('Term::ReadLin
e', 'perldb', 'GLOB(0x823a250)', 'GLOB(0x81e5a8c)')
called at /usr/share/perl/5.8/perl5db.pl line 6029
DB::setterm called at /usr/share/perl/5.8/perl5db.pl line 2203
DB::DB called at ./myscript line 12
Debugged program terminated. Use q to quit or R to restart,
use o inhibit_exit to avoid stopping after program termination,
h q, h R or h o to get additional info.
DB<1>
========================================
=

thanks,

tom arnall
north spit, ca





Tom Phoenix

2006-06-24, 8:01 am

On 6/22/06, tom arnall <kloro2006@gmail.com> 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? 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
Tom Arnall

2006-06-27, 6:57 pm

inline.

Tom Arnall


On Thursday 22 June 2006 06:35 pm, Tom Phoenix wrote:
> On 6/22/06, tom arnall <kloro2006@gmail.com> wrote:
>
> 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




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com