NAME
Venus::Role::Stashable - Stashable Role
ABSTRACT
Stashable Role for Perl 5
SYNOPSIS
package Example;
use Venus::Class;
with 'Venus::Role::Stashable';
has 'test';
package main;
my $example = Example->new(test => time);
# $example->stash;
DESCRIPTION
This package modifies the consuming package and provides methods for stashing data within the object.
METHODS
This package provides the following methods:
stash
stash(Any $key, Any $value) (Any)
The stash method is used to fetch and stash named values associated with the object. Calling this method without arguments returns all values.
Since 0.01
- stash example 1
-
package main; my $example = Example->new(test => time); my $stash = $example->stash; # {}
- stash example 2
-
package main; my $example = Example->new(test => time); my $stash = $example->stash('test', {1..4}); # { 1 => 2, 3 => 4 }
- stash example 3
-
package main; my $example = Example->new(test => time); my $stash = $example->stash('test'); # undef
AUTHORS
Cpanery, cpanery@cpan.org
LICENSE
Copyright (C) 2021, Cpanery
Read the "license" file.