Changeset 574

Show
Ignore:
Timestamp:
07/02/07 22:56:37 (2 years ago)
Author:
bradfitz
Message:
  • arguments to 'new' constructor can be %hash or $hashref now
    (previously was only $hashref)
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/api/perl/ChangeLog

    r573 r574  
     1        * arguments to 'new' constructor can be %hash or $hashref now 
     2          (previously was only $hashref) 
     3 
    14        * work around a Perl segfault (Matthieu PATOU <mp@oxado.com>) 
    25          see http://lists.danga.com/pipermail/memcached/2007-June/004511.html 
  • trunk/api/perl/lib/Cache/Memcached.pm

    r573 r574  
    6565    $self = fields::new( $self ) unless ref $self; 
    6666 
    67     my ($args) = @_; 
     67    my $args = (@_ == 1) ? shift : { @_ };  # hashref-ify args 
    6868 
    6969    $self->set_servers($args->{'servers'}); 
  • trunk/api/perl/t/all.t

    r272 r574  
    1010                                  Timeout  => 3); 
    1111if ($msock) { 
    12     plan tests => 9
     12    plan tests => 10
    1313} else { 
    1414    plan skip_all => "No memcached instance running at $testaddr\n"; 
     
    2020    namespace => "Cache::Memcached::t/$$/" . (time() % 100) . "/", 
    2121}); 
     22 
    2223 
    2324ok($memd->set("key1", "val1"), "set succeeded"); 
     
    3637 
    3738 
    38  
     39# also make one without a hashref 
     40my $mem2 = Cache::Memcached->new( 
     41                                 servers   => [ ], 
     42                                 debug     => 1, 
     43                                 ); 
     44ok($mem2->{debug}, "debug is set on alt constructed instance");