Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Error::Simple

by broquaint (Abbot)
on Aug 20, 2003 at 12:49 UTC ( #285175=note: print w/replies, xml ) Need Help??


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

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

Replies are listed 'Best First'.
Re: Re: Error::Simple
by hotshot (Prior) on Aug 20, 2003 at 12:56 UTC
    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

        Hi again!

        Here are my scripts, First SomeError.pm
        package MyError::SomeError.pm; use Error::Simple; # the line that shouts @ISA = qw(Error::Simple); 1;
        Now test.pl:
        #!/usr/bin/perl -w use Error qw(:try); use MyError::SomeError; try { throw MyError::SomeError('Throwing some error'); } catch MyError::SomeError with { print "Caught it\n"; };
        And now the error message I get:
        Can't locate MyErrors/SomeError.pm in @INC (@INC contains: /usr/lib/pe +rl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5 +/site_perl/5.8.0/i386-linux-thread-multi /usr/lib/perl5/site_perl/5.8 +.0 /usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl/5.8.0/i386-lin +ux-thread-multi /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendo +r_perl /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5. +8.0) at MyError/SomeError.pm line3. BEGIN failed--compilation aborted at MyError/SomeError.pm line3. BEGIN failed--compilation aborted at ./test.pl line 4.
        May I add that test.pl is placed under my home - ~/Perl/test.pl, and SomeError.pm is placed under ~/Perl/MyError/SomeError.pm.

        Hotshot

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (5)
As of 2020-12-02 19:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (45 votes). Check out past polls.

    Notices?