Created
March 30, 2012 02:52
-
-
Save anazawa/2246049 to your computer and use it in GitHub Desktop.
好みの問題?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| my %method_of = ( | |
| get => \&Blosxom::Header::get_header, | |
| set => \&Blosxom::Header::set_header, | |
| exists => \&Blosxom::Header::exists_header, | |
| delete => \&Blosxom::Header::delete_header, | |
| push => \&Blosxom::Header::push_header, | |
| ); | |
| while ( my ( $method, $sub_ref ) = each %method_of ) { | |
| no strict 'refs'; | |
| *$method = sub { | |
| my ( $self, @args ) = @_; | |
| $sub_ref->( $self->{header}, @args ); | |
| }; | |
| } | |
| } | |
| # 同値 (にみえる) | |
| sub get { Blosxom::Header::get_header( shift->{header}, @_ ) } | |
| sub set { Blosxom::Header::set_header( shift->{header}, @_ ) } | |
| sub exists { Blosxom::Header::exists_header( shift->{header}, @_ ) } | |
| sub delete { Blosxom::Header::delete_header( shift->{header}, @_ ) } | |
| sub push { Blosxom::Header::push_header( shift->{header}, @_ ) } | |
| # 迷わず後者を選択する |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment