Michael G Schwern > BackPAN-Index > BackPAN::Index::Role::AsHash

Download:
BackPAN-Index-0.42.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
View/Report Bugs
Source  

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>>.

syntax highlighting: