- バックアップ一覧
- ソース を表示
- Perl-Mouse/継承 (extends) は削除されています。
- 1 (2010-12-23 (木) 23:53:47)
- 2 (2010-12-24 (金) 00:49:06)
継承
extendsを使う。
User.pm
package User; use Mouse; use URI; has 'name' => ( is => 'rw', isa => 'Str' ); has 'age' => ( is => 'rw', isa => 'Int' ); has 'uri' => ( is => 'rw', isa => 'URI' ); __PACKAGE__->meta->make_immutable(); 1;
User/Man.pm
package User::Man; use Mouse; extends 'User'; has 'sex' => ( is => 'rw', isa => 'Str' ); __PACKAGE__->meta->make_immutable();