Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Best way to debug in MVC

by eXile (Priest)
on Jun 02, 2005 at 05:28 UTC ( [id://462762]=note: print w/replies, xml ) Need Help??


in reply to Best way to debug in MVC

I'm afraid the 'best way' to debug anything depends on what you are debugging, what the exact problem is you are debugging, and your debugging preferences. So I'm afraid I can't give you the 'best way'.

I sometimes use a debug switch in my code at critical points like:

my $DEBUG=1; ... my $val = get_something("vars"); warn $val if ($DEBUG && ! $val); ... my $val2 = do_something_else($val); warn $val2 if ($DEBUG && $val2 =~ /^\w{2}\d{2}$/);
This way you can turn off/on debugging by (un)setting the master-switch $DEBUG, and even use different $DEBUG values for different types of debugging, the sky is the limit.

If you want to see the call tree of your program you could use Devel::Dprof.

If you want to see the content of complex structures, you could use Data::Dumper.

Some people really like the perl debugger, you can do some cool tricks with it, see the perldebug docs.

Replies are listed 'Best First'.
Re^2: Best way to debug in MVC
by perl_devel (Friar) on Jun 02, 2005 at 05:37 UTC
    Apart from warn you have other options carp,cloak confess which gives full stack trace or minimal stack trace
    You can also use a similiar thing as mentioned before
    $DEBUG=1;
    ...
    my $val = get_something("vars"); warn $val if ($DEBUG && ! $val);
    But with a change istead of warn use mail which mails the errors to you alone instead of Showing it to entire world :=)
    Regards
    P.B.Sathish Kumar

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://462762]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-25 13:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found