Solved

how do i debug in perl on a winnt platform?

Posted on 2000-05-10
5
176 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
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 100 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…

759 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now