NAME

Venus::Role::Dumpable - Dumpable Role

ABSTRACT

Dumpable Role for Perl 5

SYNOPSIS

package Example;

use Venus::Class;

attr 'test';

with 'Venus::Role::Dumpable';

package main;

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

# $example->dump;

DESCRIPTION

This package modifies the consuming package and provides methods for dumping the object or the return value of a dispatched method call.

METHODS

This package provides the following methods:

dump

dump(Str | CodeRef $method, Any @args) (Str)

The dump method returns a string representation of the underlying data. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

Since 0.01

dump example 1
package main;

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

my $dump = $example->dump;

# "bless( {test => 123}, 'Example' )"

dump_pretty

dump_pretty(Str | CodeRef $method, Any @args) (Str)

The dump_pretty method returns a string representation of the underlying data that is human-readable and useful for debugging. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

Since 0.01

dump_pretty example 1
package main;

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

my $dump_pretty = $example->dump_pretty;

# bless( {
#          test => 123
#        }, 'Example' )