Or even:
$attr{$_} = $self->$_ if $self->${\"has_$_"} for qw/x y w h/; [download]
In reply to Re^2: Moose attribute predicate alternative by tobyink in thread Moose attribute predicate alternative by antmico