Venus::Role::Digestable

Digestable Role

Digestable Role for Perl 5

method: digest method: digester method: b64digest method: bindigest method: hexdigest

package Example;

use Venus::Class;

attr 'data';

with 'Venus::Role::Dumpable';
with 'Venus::Role::Digestable';

sub execute {
  my ($self, @args) = @_;

  return [$self->data, @args];
}

package main;

my $example = Example->new(data => 123);

# $example->digest;

# "a6c3d9ae59f31690eddbdd15271e856a6b6f15d5"

This package modifies the consuming package and provides methods for producing message digests from a dump of the object or the return value of a dispatched method call. All algorithms supported by Digest are supported, e.g. SHA-1, SHA-224, SHA-256, SHA-384, SHA-512, HMAC-MD5, HMAC-SHA-1, etc.

The digest method returns a hexadecimal formatted digest of a dump of the object or return value of a dispatched method call. The algorithm defaults to SHA-1. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

digest(string $algo, string $method, any @args) (string)

{ since => '0.01', }

=example-1 digest

package main;

my $example = Example->new(data => 123);

my $digest = $example->digest;

# "fcf148788471488b822cf72b6d6ca9c17554a4c6"

The digester method returns a Digest object with a dump of the object or return value of a dispatched method call as the message. The algorithm defaults to SHA-1. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

digester(string $algo, string $method, any @args) (string)

{ since => '0.01', }

=example-1 digester

package main;

my $example = Example->new(data => 123);

my $digester = $example->digester;

# bless(..., "Digest::SHA")

The b64digest method returns a base64 formatted digest of the object or return value of a dispatched method call. The algorithm defaults to SHA-1. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

b64digest(string $algo, string $method, any @args) (string)

{ since => '0.01', }

=example-1 b64digest

package main;

my $example = Example->new(data => 123);

my $b64digest = $example->b64digest;

# "/PFIeIRxSIuCLPcrbWypwXVUpMY"

The bindigest method returns a binary formatted digest of the object or return value of a dispatched method call. The algorithm defaults to SHA-1. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

bindigest(string $algo, string $method, any @args) (string)

{ since => '0.01', }

=example-1 bindigest

package main;

my $example = Example->new(data => 123);

my $bindigest = $example->bindigest;

# pack("H*","fcf148788471488b822cf72b6d6ca9c17554a4c6")

The hexdigest method returns a ... formatted digest of the object or return value of a dispatched method call. The algorithm defaults to SHA-1. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

hexdigest(string $algo, string $method, any @args) (string)

{ since => '0.01', }

=example-1 hexdigest

package main;

my $example = Example->new(data => 123);

my $hexdigest = $example->hexdigest;

# "fcf148788471488b822cf72b6d6ca9c17554a4c6"

t/Venus.t: present: authors t/Venus.t: present: license

31 POD Errors

The following errors were encountered while parsing the POD:

Around line 14:

Unknown directive: =name

Around line 22:

Unknown directive: =tagline

Around line 30:

Unknown directive: =abstract

Around line 38:

Unknown directive: =includes

Around line 50:

Unknown directive: =synopsis

Around line 86:

Unknown directive: =description

Around line 98:

Unknown directive: =method

Around line 105:

Unknown directive: =signature

Around line 109:

Unknown directive: =metadata

Around line 145:

=cut found outside a pod block. Skipping to next block.

Around line 165:

=cut found outside a pod block. Skipping to next block.

Around line 175:

Unknown directive: =method

Around line 182:

Unknown directive: =signature

Around line 186:

Unknown directive: =metadata

Around line 222:

=cut found outside a pod block. Skipping to next block.

Around line 232:

Unknown directive: =method

Around line 239:

Unknown directive: =signature

Around line 243:

Unknown directive: =metadata

Around line 279:

=cut found outside a pod block. Skipping to next block.

Around line 299:

=cut found outside a pod block. Skipping to next block.

Around line 309:

Unknown directive: =method

Around line 316:

Unknown directive: =signature

Around line 320:

Unknown directive: =metadata

Around line 356:

=cut found outside a pod block. Skipping to next block.

Around line 376:

=cut found outside a pod block. Skipping to next block.

Around line 386:

Unknown directive: =method

Around line 393:

Unknown directive: =signature

Around line 397:

Unknown directive: =metadata

Around line 433:

=cut found outside a pod block. Skipping to next block.

Around line 453:

=cut found outside a pod block. Skipping to next block.

Around line 463:

Unknown directive: =partials