Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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/Simple.pm 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

Thanks

Hotshot

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 Error.pm 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.

    HTH

    _________
    broquaint

      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 Error.pm and not Error/Simple.pm

      Hotshot
        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 Error.pm and not Error/Simple.pm
        The Error::Simple package is defined in the file Error.pm so there is no Error/Simple.pm - running use Error::Simple will duly fail.
        HTH

        _________
        broquaint

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

    Bewarned about Error.pm. 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 Error.pm 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 Error.pm 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.
      Error.pm is there under /usr/lib/perl5/site_perl/5.8.0/Error.pm as I mentioned I downloaded it's rpm using cpan2rpm and installed it.

      Hotshot
        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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://285172]
Approved by broquaint
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2018-07-22 09:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (453 votes). Check out past polls.

    Notices?