C
cmic
Hi
context : PerlOO Newbie.
I don't understand why this excerpt from perltoot doesn't work as
expected.
It should print "In Employe:eers", but prints "In Person:eers"
instead.
Moreover, the complete example in perltoot ("Overridden method"
paragraph) doesn't work either.
Or do I miss something ?
--------file Person.pm-------------
#!/usr/local/bin/perl
package Person;
use strict; use warnings;
sub new {
my $self = {};
$self->{NAME} = undef;
bless($self);
return $self;
}
sub name {}
sub peers { print "in Person:eers\n";}
1;
--------------file Employe.pm -----------
#!/usr/local/bin/perl
package Employe;
use Person;
use vars qw (@ISA);
use strict; use warnings;
@ISA="Person";
sub peers {
printf "In Employe:eers\n";
}
----------file a.pl -----------
#!/usr/local/bin/perl
use Employe;
use strict;
use warnings;
my $emp=Employe->new();
print $emp->peers(), "\n";
TYA
context : PerlOO Newbie.
I don't understand why this excerpt from perltoot doesn't work as
expected.
It should print "In Employe:eers", but prints "In Person:eers"
instead.
Moreover, the complete example in perltoot ("Overridden method"
paragraph) doesn't work either.
Or do I miss something ?
--------file Person.pm-------------
#!/usr/local/bin/perl
package Person;
use strict; use warnings;
sub new {
my $self = {};
$self->{NAME} = undef;
bless($self);
return $self;
}
sub name {}
sub peers { print "in Person:eers\n";}
1;
--------------file Employe.pm -----------
#!/usr/local/bin/perl
package Employe;
use Person;
use vars qw (@ISA);
use strict; use warnings;
@ISA="Person";
sub peers {
printf "In Employe:eers\n";
}
----------file a.pl -----------
#!/usr/local/bin/perl
use Employe;
use strict;
use warnings;
my $emp=Employe->new();
print $emp->peers(), "\n";
TYA