On 2/24/06, Gerald Wheeler <[EMAIL PROTECTED]> wrote:
> Running Perl on HP..
> Is there such a thing as running Perl in verbose mode?
>
> It would be nice to see the results of some of the commands, etc.
> executed/evaluated..
>
> Thanks

Luckily there is a new debug module (Devel::ebug) that makes writing
this sort of thing easy.  The following Perl script will take another
Perl script plus its arguments and print out ever line that is
executed.  Other methods allow you to do things like walk through all
of the allocated variables and print their contents, perform stack
traces, set break points (line, subroutine, and watch conditions), and
everything else you are used to being able to do in a debugger.  The
only down sides appear to be the lack of speed and the shear number of
dependencies.

#!/usr/bin/perl

use strict;
use warnings;
use Devel::ebug;

my $ebug   = Devel::ebug->new;
my $script = "";
$script = qq($script "$_") for @ARGV;
$ebug->program($script);
$ebug->load;

until ($ebug->finished) {
        print $ebug->filename, "@", $ebug->line, ":", $ebug->codeline, "\n";
        $ebug->step;
}
$ebug->return;
print "Finished!\n";

--
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