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

Re: Re: Re: Re: Error::Simple

by hotshot (Prior)
on Aug 20, 2003 at 13:28 UTC ( #285182=note: print w/ replies, xml ) Need Help??


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

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


Comment on Re: Re: Re: Re: Error::Simple
Select or Download Code
Re: Re: Re: Re: Re: Error::Simple
by tcf22 (Priest) on Aug 20, 2003 at 13:35 UTC
    Try adding
    use lib '/home/YOURNAME/Perl';
    to the top of your script.
      It didn't help, but thatnks anyway.

      Hotshot
Re: Re: Re: Re: Re: Error::Simple
by broquaint (Abbot) on Aug 20, 2003 at 13:56 UTC
    Right, firstly, Error::Simple is not a module it is a package that is defined in the file Error.pm. So SomeError.pm should look like
    package MyError::SomeError; use Error; @ISA = qw/ Error::Simple /; 1;
    Secondly, take a look at your error message - Can't locate MyErrors/SomeError.pm. Note the 's' after 'MyError', which would indicate that the code you're displaying isn't the exact code you're using.

    Please see. perlmod and Error before going any further.
    HTH

    _________
    broquaint

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2014-08-28 06:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (257 votes), past polls