Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

use Error::Simple - can't be found in @INC

by hotshot (Prior)
on Aug 20, 2003 at 12:44 UTC ( #285172=perlquestion: print w/replies, xml ) Need Help??

hotshot has asked for the wisdom of the Perl Monks concerning the following question:

Hello guys!

In relate to a previouse node I posted here I'm using Error::Simple or at least trying to use it. When I didn't wrote expilictly use Error::Simple I could catch Error::Simple exceptions, as follows:
try { throw Error::Simple('A simple error'); } catch Error::Simple with { # handle Error }
Now, When I need to explicitly use Error::Simple, I get an error message that Error/ can't be found in @INC. I guess it didn't came with perl-Error-0.15-1.i386.rpm I installed yesterday (downloaded using cpan2rpm). Anyhow I tried downloading Error::Simple using cpan2rpm and it couldn't be found in CPAN, anyone know where can I find it, or I must install it through perl -MCPAN -eshell



edited by ybiC: retitle from "Error::Simple"

Replies are listed 'Best First'.
Re: Error::Simple
by broquaint (Abbot) on Aug 20, 2003 at 12:49 UTC
    Because Error::Simple is defined within you just need to do
    use Error;
    and you can be along your merry way e.g
    use Error ':try'; try { throw Error::Simple("Holy Smokes!"); } catch Error::Simple with { warn "ack - $_[0]"; }; __output__ ack - Holy Smokes! at - line 5.



      Sorry, my fault, I didn't mention that I have:
      use Error ':try';
      In my code (didn't put it in the example), and it's still displays the same error.
      I will also add that I ran a search on my perl directories and could find only and not Error/

        Have you tried the code above? If it doesn't work I shall be quite surprised, and would also like to see the exact code used and the exact error message produced.
        I will also add that I ran a search on my perl directories and could find only and not Error/
        The Error::Simple package is defined in the file so there is no Error/ - running use Error::Simple will duly fail.


Re: Error::Simple
by hardburn (Abbot) on Aug 20, 2003 at 14:01 UTC

    Bewarned about It has some nasty problems with closures, and I've decided to shy away from it, despite the fact that I happen to like Java-style exception handling. Personally, I go with Exception::Class, which doesn't give you the nice syntax that does, but its good enough:

    use Exception::Class ('MyException'); eval { # Pretend this says 'try' MyException->throw( error => 'I feel funny.'; }; if( UNIVERSAL::isa( $@, 'MyException' ) ) { # Pretend this says 'catc +h MyException' warn $@->error, "\n, $@->trace->as_string, "\n"; warn join ' ', $@->euid, $@->egid, $@->uid, $@->gid, $@->pid, $@ +->time; exit; }

    I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
    -- Schemer

    Note: All code is untested, unless otherwise stated

Re: Error::Simple
by bear0053 (Hermit) on Aug 20, 2003 at 13:40 UTC
    You can always check your perl path and actually see if is there so you no if it is installed or not. should be something like c:\perl\lib or c:\perl\site\lib then just look for the Error directory to know if you have it. If you are using an activestate build just go to the command prompt and type ppm. this will bring up a new prompt then type 'install Error' and that will get it for you. is there under /usr/lib/perl5/site_perl/5.8.0/ as I mentioned I downloaded it's rpm using cpan2rpm and installed it.

        My bad...didn't realize that you were using a unix distr...but if anyone else reads this node, this is how you would install it on a win machine with an active state build.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://285172]
Approved by broquaint
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-11-28 02:58 GMT
Find Nodes?
    Voting Booth?

    No recent polls found