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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|