* blessを使ったPerlオブジェクト指向 [#yefcf25c]

** コンストラクタ [#t0c238d8]
 sub new {
     my $class = shift;
     bless {@_}, $class;
 }


** デストラクタ [#wbfe4f23]
 sub DESTROY {
     my $self = shift;
     $self->{fh}->close;
 }

** コンストラクタで親クラスのコンストラクタを呼ぶ [#f78020cd]
 sub new {
     my $class = shift;
     my $self = $class->SUPER::new(@_);
     $self->{foo} = 'var';
     return $self;
 }

トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS