BackPAN::Index::Role::AsHash(3)

NAME
BackPAN::Index::Role::AsHash - Role to dump object data as a hash

SYNOPSIS
    use BackPAN::Index::Role::AsHash;

    sub data_methods { return qw(list of data methods) }

DESCRIPTION
A role to implement "<as_hash"> in result objects.

  Requires
The receiving class must implement...

data_methods

    my @methods = $self->data_methods;

Returns a list of methods which get data about the object.

  Implements
as_hash

    my $hash = $self->as_hash;

Produces a hash reference representing the object's data based on "<$self-"data_methods>>. Each key is a method name, the value is "<$self-"$method>>.