Venus::Role::Printable

Printable Role

Printable Role for Perl 5

method: print method: print_json method: print_pretty method: print_string method: print_yaml method: say method: say_json method: say_pretty method: say_string method: say_yaml

package Example;

use Venus::Class;

with 'Venus::Role::Dumpable';
with 'Venus::Role::Printable';

attr 'test';

sub execute {
  return [@_];
}

sub printer {
  return [@_];
}

package main;

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

# $example->say;

This package provides a mechanism for outputting (printing) objects or the return value of a dispatched method call to STDOUT.

The print method prints a stringified representation of the underlying data.

print(any @data) (any)

{ since => '0.01', }

=example-1 print

package main;

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

my $print = $example->print;

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

# 1

The print_json method prints a JSON 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.

print_json(string | coderef $method, any @args) (any)

{ since => '2.91', }

=example-1 print_json

package main;

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

my $print_json = $example->print_json;

# "{\"test\": 123}"

The print_pretty method prints a stringified human-readable representation of the underlying data.

print_pretty(any @data) (any)

{ since => '0.01', }

=example-1 print_pretty

package main;

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

my $print_pretty = $example->print_pretty;

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

# 1

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

print_string(string | coderef $method, any @args) (any)

{ since => '0.09', }

=example-1 print_string

package main;

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

my $print_string = $example->print_string;

# 'Example'

# 1

The print_yaml method prints a YAML 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.

print_yaml(string | coderef $method, any @args) (any)

{ since => '2.91', }

=example-1 print_yaml

package main;

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

my $print_yaml = $example->print_yaml;

# "---\ntest: 123"

The say method prints a stringified representation of the underlying data, with a trailing newline.

say(any @data) (any)

{ since => '0.01', }

=example-1 say

package main;

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

my $say = $example->say;

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

# 1

The say_json method prints a JSON 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, with a trailing newline.

say_json(string | coderef $method, any @args) (any)

{ since => '2.91', }

=example-1 say_json

package main;

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

my $say_json = $example->say_json;

# "{\"test\": 123}\n"

The say_pretty method prints a stringified human-readable representation of the underlying data, with a trailing newline.

say_pretty(any @data) (any)

{ since => '0.01', }

=example-1 say_pretty

package main;

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

my $say_pretty = $example->say_pretty;

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

# 1

The say_string method prints a string representation of the underlying data without using a dump, with a trailing newline. This method supports dispatching, i.e. providing a method name and arguments whose return value will be acted on by this method.

say_string(string | coderef $method, any @args) (any)

{ since => '0.09', }

=example-1 say_string

package main;

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

my $say_string = $example->say_string;

# "Example\n"

# 1

The say_yaml method prints a YAML 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, with a trailing newline.

say_yaml(string | coderef $method, any @args) (any)

{ since => '2.91', }

=example-1 say_yaml

package main;

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

my $say_yaml = $example->say_yaml;

# "---\ntest: 123\n"

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

45 POD Errors

The following errors were encountered while parsing the POD:

Around line 13:

Unknown directive: =name

Around line 21:

Unknown directive: =tagline

Around line 29:

Unknown directive: =abstract

Around line 37:

Unknown directive: =includes

Around line 54:

Unknown directive: =synopsis

Around line 90:

Unknown directive: =description

Around line 99:

Unknown directive: =method

Around line 103:

Unknown directive: =signature

Around line 107:

Unknown directive: =metadata

Around line 147:

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

Around line 157:

Unknown directive: =method

Around line 163:

Unknown directive: =signature

Around line 167:

Unknown directive: =metadata

Around line 206:

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

Around line 219:

Unknown directive: =method

Around line 224:

Unknown directive: =signature

Around line 228:

Unknown directive: =metadata

Around line 273:

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

Around line 283:

Unknown directive: =method

Around line 289:

Unknown directive: =signature

Around line 293:

Unknown directive: =metadata

Around line 321:

Unknown directive: =method

Around line 327:

Unknown directive: =signature

Around line 331:

Unknown directive: =metadata

Around line 370:

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

Around line 383:

Unknown directive: =method

Around line 388:

Unknown directive: =signature

Around line 392:

Unknown directive: =metadata

Around line 432:

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

Around line 442:

Unknown directive: =method

Around line 448:

Unknown directive: =signature

Around line 452:

Unknown directive: =metadata

Around line 491:

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

Around line 504:

Unknown directive: =method

Around line 509:

Unknown directive: =signature

Around line 513:

Unknown directive: =metadata

Around line 558:

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

Around line 568:

Unknown directive: =method

Around line 575:

Unknown directive: =signature

Around line 579:

Unknown directive: =metadata

Around line 607:

Unknown directive: =method

Around line 613:

Unknown directive: =signature

Around line 617:

Unknown directive: =metadata

Around line 656:

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

Around line 669:

Unknown directive: =partials