|
Posted by Badari Kakumani on February 13, 2006, 7:13 pm
Please log in for more thread options
folks,
i have recently started using the exception handling using
try ... catch ... otherwise ... finally.
those are great OO concepts.
when i use perl debugger on code using the above try... catch etc,
i am unable to step thru the code in those try ... catch blocks.
is there any way to step thru those blocks of code which seem to be
getting executed as a single unit (like eval i think)?
thanks for your help,
-badari
|
|
Posted by Eric Schwartz on February 14, 2006, 11:23 am
Please log in for more thread options
> i have recently started using the exception handling using
> try ... catch ... otherwise ... finally.
>
> those are great OO concepts.
They also don't exist in Perl, at least not under those names. Are
you using a module which provides functions with those names, such as
Exception::Class::TryCatch? If so, you really need to tell us,
because CPAN is huge, and nobody knows offhand which modules you're
using if you don't tell us.
Also, have you read the Posting Guidelines? They're not meant to
cause you pain, but if you read them, and follow them, then you will
make it very easy for us to help you. Specifically, one of the
guidelines is that you should post the smallest complete program
possible that exhibits your problem. Once you get it running (I think
it should only be 10 or 12 lines, at most), cut and paste it here-- do
NOT retype it! Every single time I see somebody retype their code,
they always make a mistake. When you cut and paste, if there is a
mistake, it's a real one, not a mistake introduced by typos.
> when i use perl debugger on code using the above try... catch etc,
> i am unable to step thru the code in those try ... catch blocks.
>
> is there any way to step thru those blocks of code which seem to be
> getting executed as a single unit (like eval i think)?
You need to tell us what these try/catch blocks are, and how you get
them. Perl does not have them by default, so it is your job to tell
us where they came from.
-=Eric
|
|
Posted by Eric Schwartz on February 14, 2006, 11:24 am
Please log in for more thread options
> Also, have you read the Posting Guidelines?
Oops, my mistake, sorry. I thought I was in c.l.p.misc, not .modules.
Anyway, if the OP were to read the Posting Guidelines in c.l.p.misc,
they would help him ask helpful questions. :)
-=Eric
|
|
Posted by Badari Kakumani on February 14, 2006, 2:48 pm
Please log in for more thread options
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();
|
|
Posted by Eric Schwartz on February 15, 2006, 11:18 am
Please log in for more thread options
> 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 :)
That's usually the case, which is why the advice to do so in the first
place. :)
> looks like my problem was that my code was using 'try' as defined
> by Error.pm std perl module.
I have never used that module. I'm not sure I even knew it existed.
I may have to play with it a bit, just for giggles.
-=Eric
|
| Similar Threads | Posted | | stepping out | July 15, 2005, 1:55 pm |
| Graphical debugger for a newbee | November 26, 2004, 1:55 am |
| invalid COMMPROP block length= 100...... | November 16, 2005, 8:21 am |
| RFC: Crypt::Skip32 - 32-bit block cipher based on Skipjack | September 23, 2007, 6:15 am |
| debugging issue with Net::FTP | January 1, 2005, 2:36 pm |
| Script debugging | June 24, 2006, 12:06 am |
| ISO: deep voodoo debugging tools for tracking down seriously weird module behavior. | November 9, 2007, 1:28 pm |
|