Help for this page

Select Code to Download


  1. or download this
    package QuackLog; use Moose; use namespace::autoclean; use strict; my 
    +@log_string_parts = qw(timestamp foo bar baz qux norf quack honk woof
    + meow blerf); has $_=> (is => 'rw') for(@log_string_parts); has log_s
    +tring => ( is => 'rw', reader=> 'get_log_string', writer => 'set_log_
    +string', ); sub get_log_string{ my ($self) = shift; return(join ' ',m
    +ap {$self->can($_);$self->$_} @log_string_parts); } sub set_log_strin
    +g{ my ($self,$s)=@_; my @part_values=split / /,$s; for my $method (@l
    +og_string_parts){ $self->can($method); $self->$method(shift @part_val
    +ues); } $self; } __PACKAGE__->meta->make_immutable();
    
  2. or download this
    You are overwriting a locally defined method (get_log_string) with an 
    +accessor...