YAPC::2004::Israel << Previous | Index | Next >> Copyright © 2004 Gaal Yahas

Refactoring with Class::Accessor


  • grep my | split to variables | sort | uniq to list all locals

  • pick which ones should be fields

  • group them into sets by usage

     my %f;
     my $f{job_spec} = [qw/CustomerName CustomerID RequestID
             RequestType/]; # come by @_
     my $f{cust}     = [qw/CustomerLocation PreferredCustomerStatus/];
     my $f{job}      = [qw/Technician JobLocation JobHours/];
     my .... # other phases go here
     my @all = (@f{qw/job_spec cust job, #....
             });

continued...