as:$shift->caption($args->{'caption'}); $shift->starts($args->{'starts'}); $shift->ends($args->{'ends'}); $shift->monday($args->{'monday'}); $shift->tuesday($args->{'tuesday'}); $shift->wednesday($args->{'wednesday'}); $shift->thursday($args->{'thursday'}); $shift->friday($args->{'friday'}); $shift->saturday($args->{'saturday'}); $shift->sunday($args->{'sunday'}); $shift->holiday($args->{'holiday'});
You're specifying things twice (name of method and name of field in hash), which is always bad from a maintenance point of view.$shift->$_( $args->{$_} ) foreach qw( caption starts ends monday tuesday wednesday thursday friday saturday sunday holiday );
Also, I find the use of $shift confusing: usually a variable called $self is a more common idiom.
Liz
In reply to Re: Class::DBI misbehaviour
by liz
in thread Class::DBI misbehaviour
by TVSET
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |