Operating System - HP-UX
1822000 Members
3667 Online
109639 Solutions
New Discussion юеВ

Re: Running perl script in debug mode

 
Shivkumar
Super Advisor

Running perl script in debug mode

Hello,

We run shell script in debug mode using the switch -x as below.
#!/bin/sh -x

How do we run perl script in debug mode similar to the above one ?

Thanks,
Shiv
3 REPLIES 3
Ganesan R
Honored Contributor

Re: Running perl script in debug mode

Hi Shivkumar,

#perl -d <script name>
Best wishes,

Ganesh.
Ganesan R
Honored Contributor

Re: Running perl script in debug mode

Hi,

perl man page is here..

http://www.zedat.fu-berlin.de/cgi-bin/compute/perl.cgi
Best wishes,

Ganesh.
James R. Ferguson
Acclaimed Contributor

Re: Running perl script in debug mode

Hi Shiv:

This is a bit different. First, always use the 'strict' and 'warnings' pragma. You can get more detailed warnings by adding the 'diagnostics' pragma. You can always add your own debugging print statements too.

You can syntax check with:

# perl -c

You should see:

# man perldebtut
# perldoc perldebtut

...for more gory details.

Since Perl is compiled before it executes, unlike the interpretative shell, a successful compilation ('perl -c') means that syntactically all is OK. Whether or not the code does what you want or not, however, is the matter with computers :-)

Regards!

...JRF...