?
Solved

how do i debug in perl on a winnt platform?

Posted on 2000-05-10
5
Medium Priority
?
218 Views
Last Modified: 2010-03-05
i have just downloaded the latest release of perl, and i as understand it there is a debugger built into it.  i am running winnt 4.0 service pack 5.  i thought i could just enter the -d switch after i run perl and i would be able to debug.  but this didn't work.  please help.
0
Comment
Question by:krella
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 12

Expert Comment

by:geotiger
ID: 2798198
perl -d

or

#!/usr/local/bin/perl -d

0
 
LVL 19

Expert Comment

by:Kim Ryan
ID: 2798216
The built in Perl debugger is only text based, you run it by starting an MS-DOS window and typing :
perl -d your_script.pl.

If you want to pay money, ActiveState make a developer kit with a windows based visual debugger built in: http://www.activestate.com/pdk/ 

0
 
LVL 3

Expert Comment

by:jyu_88
ID: 2798484
perl -w yourScript.pl

suits me the best. I know it is not a debugger. but, it surely gives a lot of warnings I need.
0
 
LVL 8

Expert Comment

by:shlomoy
ID: 2798969
perl -wc your_perl_script.pl

issues both warnings and compile messages.
0
 
LVL 16

Accepted Solution

by:
maneshr earned 400 total points
ID: 2800330
krella,

this might not be the exact solution you are looking for but its a viable one all the same.

i would suggest you use a debugging variable in your program.
this variable (lets day $debug) would have only two possible values 0 & 1.

when $debug has the value 0, debugging mode is off.
when $debug has the value 1, debugging mode is on.

when the debug mode is on, debugging message would be printed on your standard output (screen or browser window) and you can track the progress of your script.

here is a small example.

#!/usr/local/bin/perl

$debug=0;

$salary="100000";
$tax_pct=".2";


print "Salary is $salary \n" if $debug;
print "Tax percent is $tax_pct \n" if $debug;

$tax_amt=$salary * $tax_pct;

print "Tax amount is $tax_amt\n";

===========

try this script as is & see the output.

Next make the value of $debug to 1 and then see the output.

this solution is totally protable and not dependent on any external tool!!
0

Featured Post

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question