At 08:45 PM 6/22/02 -0700, Harry Putnam wrote:
>Peter Scott <[EMAIL PROTECTED]> writes:
> > Tracing isn't generally as useful for a Perl script as for a shell
> > script because a shell script typically executes far fewer statements
> > than the average Perl script.  So the output can be unreasonably
> > verbose.
>
>What OP (me) wanted in this case is to run a perl script that
>conducts a backup  of certain files, checks the age of other
>accumulated backups, deletes ones older than $X.  And does some other
>checks and mails a report.
>
>I wanted to get the report as well as the commands as they execute
>while the script is running.
>
>The perl code prints to FILEHANDLES So I can insert a second print to
>tty at each and a print to echo the commands:
>(NOTE:Exaggerated example code, not a working script)
>
>open(FILEHANDLE,">>some.file");
>open(PROC."some tar process");
>print "Starting \"some tar process\"\n";
>    while(<PROC>){
>       print FILEHANDLE $_;
>       push @A,$_;
>       print $_;
>}
>[...]
>close(PROC);
>open(PROC2,"|mail -s "backup report" reader");
>print PROC2 @A;
>close(PROC2);
>close(FILEHANDLE);
>
>etc etc .. That is, shadow every process like the first one above
>for debug purposes. in addition to printing to whatever filehandles.
>(Only the first part above is shadowed for an example)
>All quite a pain in the butt.  I wanted a better way that mimics sh
>-x.
>
>Can you show what the output of the `t' flag or the others you
>mentioned would be like on the above simple code?

It's going to print one line for each line of code that gets 
executed.  Which will be 8 plus 3 * the number of lines read from 
PROC.  How many do you expect that to be?  No variable substitutions 
will be performed on each line, so they won't show you the current information.

No-one does what you want by using the debugger trace mode; they do it 
by explicitly printing a line intended to be logging information.
--
Peter Scott
Pacific Systems Design Technologies
http://www.perldebugged.com/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to