Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Using Perl Exception Class

by Corion (Patriarch)
on Apr 20, 2011 at 08:58 UTC ( [id://900295]=note: print w/replies, xml ) Need Help??


in reply to Using Perl Exception Class

You don't tell us what concept of "structured exception" you are using. If you are using one of the modules on CPAN, like Exception::Class or Exception, have you looked at the documentation?

If you think implementing your own mechanism makes sense, take a look at eval and/or Try::Tiny.

As an aside, the code you posted does not compile. Perl does not like the kinds of quotes you use:

”Performing the command” # should be "Performing the command" ‘MyException’ # should be 'MyException'

Replies are listed 'Best First'.
Re^2: Using Perl Exception Class
by Perllace (Acolyte) on Apr 20, 2011 at 09:18 UTC
    Hi Corion I think Exception::Class will suit my need.. how do i use it??
        Hi Corion, I'm sorry about this..I'm really ignorant about exceptions...

        As of now, I have a module of the kind

        package MyExceptions; use strict; use warnings; use Exception::Class ( 'MyExceptions', 'MyExceptions::RegionNotFound' => { isa => 'MyExceptions' }, 'MyExceptions::CommandNotExecuted' => { isa => 'MyExceptions' } );
        The other module is
        package ReportGenerator; use strict; use warnings; sub CheckResult { my ( $result, $info ) = @_; #Here is want to check of $result and throw an exception of the kin +d MyExceptions::RegionNotFound->throw(error => 'bad number'); #I'm not sure how to do this.. } 1;
        The user would inturn script something like this $Report->CheckResult($ABC->Command(100,100),"Tapping Home");

        Thanks for your help..

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-18 19:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found