Turning on Debugging for a perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Turning on Debugging for a perl script
# 1  
Old 05-09-2012
Turning on Debugging for a perl script

for security reasons I can not post any part of the script in question in this thread. i hope im not breaking any rules by not doing so.

but i have a perl script that i've been asked to turn on debugging on.

i didn't write this perl script and i have very very little knowledge of perl. so i have no idea what to do.

i know in bash programming, to turn on debugging, you just simply add a "set -x" to the beginning of the script, right after the defining the shell to use.

but in perl, i'm presuming there has to be a similar straight to the point code i can insert into the script to start debugging it?
# 2  
Old 05-09-2012
Put this at top of script:

Code:
#!/usr/bin/perl
use warnings;

Then run it with -d, like this:

Code:
./test.pl -d

These 2 Users Gave Thanks to brianjb For This Post:
# 3  
Old 05-09-2012
Also, if you want even more debugging information (long winded) add this line:

Code:
use diagnostics;

These 2 Users Gave Thanks to in2nix4life For This Post:
# 4  
Old 05-09-2012
you guys are the best!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Debugging mysterious perl script problem

the attached perl script is a deamon that, once kicked off from the command line, it runs in the background and waits for the master server to tell it what plugins to run. the script works well. but the problem is, whenever i start it, after about a few seconds of starting it, i start getting... (4 Replies)
Discussion started by: SkySmart
4 Replies

2. Shell Programming and Scripting

Help turning pseudocode into ksh script

Hi gurus, My boss has asked me to create a unix script to check header files vs data files and to send an email in case of any failure. I have very little unix scripting experience and it was now long ago so I'm a bit concerned I wont be able to turn this around by end of day tomorrow. ... (4 Replies)
Discussion started by: Leedor
4 Replies

3. Shell Programming and Scripting

Shell script debugging

hi all only the weirdest thing happened with me just now. I was debugging a shell script and I found that a step that was supposed to execute later was getting executed prior to another step for no reason. You know any ? i mean have a look at the following command- here it tries to grep... (7 Replies)
Discussion started by: leghorn
7 Replies

4. Shell Programming and Scripting

Debugging a script with noexec

Newbie question. I cannot get "set -n" or "set -noexec on" to work on Linux or AIX! According to the man page and what I read online, it should inform me of syntax errors without executing commands in your script. So, can someone PLEASE explain why this does not work? ... (2 Replies)
Discussion started by: fgoyti
2 Replies

5. Shell Programming and Scripting

Methods For Debugging Perl Problems

Note: Not a programmer by profession but occasionally have to program. I am looking for general methods and freely/readily available tools employed to debug problems during development of perl scripts. Anything that has really helped you out with problems you just couldn't find. A couple of... (5 Replies)
Discussion started by: Vi-Curious
5 Replies

6. Shell Programming and Scripting

script debugging

is there any way you can add a breakpoint in a script so you can stop on it? i have used -xv in my shebang but the script just runs and i want it to stop at a specific point in the script. appreciate any help. (1 Reply)
Discussion started by: npatwardhan
1 Replies

7. Shell Programming and Scripting

debugging a script??

Hi all, Am working on a script to understand the flow control of it.. Since i am from a C background i looking out for an easy way to analyze the script as it runs .. In C/C++ we have F7 that starts execution from main() and proceeds accordingly.. I was wondering if there is a same approach... (2 Replies)
Discussion started by: wrapster
2 Replies

8. Solaris

Script for turning processes in etc/inetd.conf on and off

Anyone have a perl script that can be run via a web browser to turn ftp or telnet on and off in etc/inetd.conf ? Believe it or not but I ride a motorcycle a lot in the summer and carry a laptop in my saddlebags to connect from almost anywhere via Verizon alongside the highway. However, have too... (0 Replies)
Discussion started by: thomi39
0 Replies

9. Shell Programming and Scripting

FTP script debugging

Hello all, I am trying to run a script and have not had much success running it...ne help debugging it will be appreciated..The ftp script alone works but not within the while loop. below is the script #!/usr/bin/ksh destination_server=servename destination_user_id=un... (1 Reply)
Discussion started by: alfredo123
1 Replies

10. Shell Programming and Scripting

HP-UX Debugging Shell script

Hi, I was using AIX - ksh shell , and inorder to debug shell script I used set -vx to echo all the commands which are being executed. Can anybody tell me the corresponding method in HP-UX - in tcsh shell. Regards Shihab (1 Reply)
Discussion started by: shihabvk
1 Replies
Login or Register to Ask a Question