bless $class, [ @_ ]; #### $e->index( index => $index, type => $type, id => $id, body => { head => $object->head, opinion => $object->opinion, result => $object->result, }, ); #### sub hashify { my $self = shift; return { %$self } } #### my @attributes = qw( head opinion result ); sub hashify { my $self = shift; return { map { $attributes[$_] => $self->[$_] } 0 .. $#$self } }