H
howa
Hi,
I encountered a problem when using perl's OOP feature"
Directory Layout:
----------------------
c:\temp\perl\test.pl
c:\temp\perl\class\user.pm
user.pm
----------------------
package class::user;
sub new {
my ($class) = @_;
my $objref = {};
bless $objref, $class;
}
sub print_me {
my ($self) = @_;
print "is me!";
}
1;
----------------------
test.pl
----------------------
use lib "C:\\temp\\perl";
use class::user;
$u = new user();
----------------------
and it returns :
Can't locate object method "new" via package "user" (perhaps you forgot
to load
"user"?) at test.pl line 5.
what's wrong with the codes?
thanks...
I encountered a problem when using perl's OOP feature"
Directory Layout:
----------------------
c:\temp\perl\test.pl
c:\temp\perl\class\user.pm
user.pm
----------------------
package class::user;
sub new {
my ($class) = @_;
my $objref = {};
bless $objref, $class;
}
sub print_me {
my ($self) = @_;
print "is me!";
}
1;
----------------------
test.pl
----------------------
use lib "C:\\temp\\perl";
use class::user;
$u = new user();
----------------------
and it returns :
Can't locate object method "new" via package "user" (perhaps you forgot
to load
"user"?) at test.pl line 5.
what's wrong with the codes?
thanks...