For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > February 2006 > Re: debugging (stepping thru in debugger) within a try block









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: debugging (stepping thru in debugger) within a try block
Badari Kakumani

2006-02-14, 6:56 pm

hi eric,

no problem. actually the guidelines you noted are good in general and
am
going to follow for my further posts.

writing sample program gave me the solution :)

looks like my problem was that my code was using 'try' as defined
by Error.pm std perl module. looks like this module would try to
execute
the entire 'try block' as some anonymous code segment and hence won't
allow
you to step into the code.

looks like perl 5.8.6 does understand try natively and if you use it,
debugger has
no problem stepping into the try blocks.

hopefully the program listing i have answers your other quesions as to
which cpan module i am using etc.

thanks,
-badari

# note that in the program below you will be able to step into the
# try blocks if you comment out 'use Error qw(:try)'.


#!/usr/cisco/bin/perl5.8 -w

use Error qw(:try);
use Exception::Class (
SubExc => {},
);


sub main {
try {
my $v1 = 'v1'; # you can't break here if you are using
Error::try
sub2();
} catch Exception::Class::Base with {
shift->throw();
} otherwise {
shift->throw();
}
}

sub sub2 {
try {
my $v1 = 'abc';
throw SubExc "exception while performing sub processing";
}
}

&main();

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com