Solved

how do i debug in perl on a winnt platform?

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.

776 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