I am giving exact code and error
I have two folders one is hello and second one is myfolder. Both the folder are parallel like A and B
. Folder hello contains hello.pl and myfolder folder contains package1.pm
Both the folder are in eg folder
hello.pl
#!/usr/local/bin/perl
use Data::Dumper;
use eg::myfolder::package1;
print @INC;
my $package1 = new package1();
warn "package ".Dumper($package1);
my $prnt = package1::DESTROY();
print "$prnt";
package1.pm
package package1;
sub new {
my($class, $name) = @_; # Class name is in the first parameter
my $self = { name => $name }; # Anonymous hash reference holds instance attributes
bless($self, $class); # Say: $self is a $class
return $self;
}
sub DESTROY {
return 'package2';
}
1;
Error :
Can't locate eg/myfolder/package1.pm in @INC (@INC contains: C:/Perl/site/lib C:
/Perl/lib .) at hello.pl line 3.
BEGIN failed--compilation aborted at hello.pl line 3.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.