Changeset 13830

Show
Ignore:
Timestamp:
06/13/08 22:45:55 (5 years ago)
Author:
topia
Message:

* support value deletion.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/tiarra/trunk/main/BulletinBoard.pm

    r11365 r13830  
    2323    my ($class_or_this,$key,$value) = @_; 
    2424    my $this = $class_or_this->_this; 
    25     $this->{table}->{$key} = $value; 
     25    if (defined $value) { 
     26        $this->{table}->{$key} = $value; 
     27    } else { 
     28        delete $this->{table}->{$key}; 
     29    } 
    2630    $this; 
    2731} 
     
    4044    # $board->foo_bar => $board->get('foo-bar') 
    4145    # $board->foo_bar('foo') => $board->set('foo-bar','foo'); 
    42     my ($class_or_this,$newvalue) = @_; 
     46    my $class_or_this = shift; 
    4347    my $this = $class_or_this->_this; 
    4448    (my $key = $AUTOLOAD) =~ s/.+?:://g; 
    4549    $key =~ s/_/-/g; 
    4650 
    47     if (defined $newvalue) { 
    48         $this->set($key,$newvalue); 
     51    if (@_ > 0) { 
     52        $this->set($key, @_); 
    4953    } 
    5054    else {