On 8/24/05, praba har <[EMAIL PROTECTED]> wrote: > Dear All, > > I try to run a sampleclass example program > in perl. But I received error. How to avoid it? > The code is below: > > Package Person; > > sub new > { > my($type) = $_[0]; > my($self) = {}; > $self->{'name'} = $_[1]; > bless($self, $type); > return($self); > } > > sub tellname > { > my($self)=$_[0]; > print "Person name is $self->{'name'}.\n"; > } > > return(1); > > Class calling program is below: > ******************************* > se lib $ENV{"HOME"}."/perl"; > print $ENV{"HOME"}."\n"; > use Person; > $obj = Person->new('Prabahar'); > $wr->tellname(); > > error report is below: > ********************** > > Can't locate Person.pm in @INC (@INC contains: > /Users/enmail/perl > /System/Links/Libraries/perl5/5.8.7/i686-linux > /System/Links/Libraries/perl5/5.8.7 > /System/Links/Libraries/perl5 > /System/Links/Libraries/perl5/site_perl/5.8.7/i686-linux > /System/Links/Libraries/perl5/site_perl/5.8.7 > /System/Links/Libraries/perl5/site_perl > /Programs/Perl/5.8.7/lib/perl5/5.8.7/i686-linux > /Programs/Perl/5.8.7/lib/perl5/5.8.7 > /Programs/Perl/5.8.7/lib/perl5/site_perl/5.8.7/i686-linux > /Programs/Perl/5.8.7/lib/perl5/site_perl/5.8.7 > /Programs/Perl/5.8.7/lib/perl5/site_perl .) at > class_calling.pl line 3. > BEGIN failed--compilation aborted at class_calling.pl > line 3. > How I need to run this script.
You have to include Person.pm location in @INC location. As, @INC=(@INC,.); or run perl with -I option also. perl -I. <perlfile> hth. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>