ISA Perl
--HogeA.pm
package HogeA;
use strict;
sub new {
my $class = shift;
my $self = bless {}, $class;
return $self;
}
sub hoge {
my $self = shift;
print "Hoge::hoge\n";
}
1;
--HogeB1.pm
package HogeB1;
use strict;
use HogeA;
our @ISA = qw ( HogeA );
# use base qw(HogeA);
sub new {
my $class = shift;
my $self = HogeA->new();
return bless $self, $class;
}
sub hogehoge{
print "hogehoge\n";
}
1;
--sample.pl
use strict;
use HogeB1;
my $b = HogeB1->new();
$b->hoge;
--result
Hoge::hoge
0 Comments:
コメントを投稿
<< Home