タグ

oopに関するsaihatenoのブックマーク (2)

  • tokuhirom blog

    Blog Search when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: ${entry.path} [in template "__entry.ftlh" at line 3, column 25] - Reached through: #include "__entry.ftlh" [in template "entry.ftlh" at

  • 404 Blog Not Found:perl - 万能なnewの書き方

    2007年04月23日22:45 カテゴリLightweight Languages perl - 万能なnewの書き方 Perl 5のOOは、慣れてしまうと簡単だ。 継承とか考えずに、普通にクラスを作りたければ、必要なのは以下の二行だけ。 package Klass; sub new { bless {} }; これだけでは何もできないので、とりあえずnameというアクセサーを追加してみる。これだけ。 sub name { my $self = shift; $self->{name} = shift if @_; return $self->{name}; } しかし、上の形式だと、継承をサポートしていない。だから、 package Klass; sub new { bless {} }; package Klass::Sub; our @ISA = qw/Klass/; # new

    404 Blog Not Found:perl - 万能なnewの書き方
  • 1