Solved

how do i debug in perl on a winnt platform?

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
compress files in RAR using perl 13 88
Trying to use two loops in a perl script but not getting results need. 10 99
Perl output collect 7 69
perl getopt long help 34 84
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.…
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…

740 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