オブジェクトの例(3/4) package Music::Media::CD; use Jukebox; @ISA = qw(Music::Media); # 継承 sub play { my $self = shift; my $number = $self->{number}; Jukebox->bynumber($number)->play; } package Music::Media::MP3; use MP3; @ISA = qw(Music::Media); sub play { my $self = shift; for (@{$self->{contents}}) { MP3::play($_->[2]); sleep(2); } }