jesuashok has asked for the wisdom of the Perl Monks concerning the following question:

all monks,

#!/usr/bin/ksh set -x ls echo "Hello World"
In the above shell script we can see the line by line execution when I execute the script. I would like to have the same feature when I execute the perl script too. could anyone recommend a module for this.
I am aware that using the debug we will be able to see the line by line execution as follows :-
perl -d <program.pl>
anotherway which, I can use is logging mechanism. But I would like to have some other alternative. could anyone adive me on the same ? It is better If I have the same feature like set -x as shell programming does.

"Keep pouring your ideas"

Replies are listed 'Best First'.
Re: Viewing perl execution line by line - debug flags
by imp (Priest) on Dec 08, 2006 at 02:11 UTC
    PERLDB_OPTS="NonStop AutoTrace LineInfo=foo.trace" perl -d foo.pl
    Contents of foo.pl:
    print "foo\n"; print "bar\n";
    Content of foo.trace:
    main::(foo.pl:1): print "foo\n"; main::(foo.pl:2): print "bar\n"; Config::DESTROY(/usr/libdata/perl5/i386-openbsd/5.8.2/Config.pm:1265): 1265: sub DESTROY { } IO::Handle::DESTROY(/usr/libdata/perl5/i386-openbsd/5.8.2/IO/Handle.pm +:326): 326: sub DESTROY {}
    See perldebug for more options.
      thanks imp,

      PERLDB_OPTS="NonStop AutoTrace LineInfo=foo.trace" helped me. thanks again.
Re: Viewing perl execution line by line
by Fletch (Bishop) on Dec 08, 2006 at 02:07 UTC

    search.cpan.org is your friend; the second item that shows up for a search for "sh -x" is the answer, Devel::Trace.

Re: Viewing perl execution line by line
by cog (Parson) on Dec 08, 2006 at 02:25 UTC