Created
February 17, 2021 02:23
-
-
Save akanehara/db59029941514497947787f69d5cabbe to your computer and use it in GitHub Desktop.
HTTP::Message などで使われているアクセッサ実装ヘルパー
This file contains 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
sub foo { shift->_elem('_foo', @_); } | |
sub bar { shift->_elem('_bar', @_); } | |
sub _elem | |
{ | |
my $self = shift; | |
my $elem = shift; | |
my $old = $self->{$elem}; | |
$self->{$elem} = $_[0] if @_; | |
return $old; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment