Nano::Stash - Stashable Role
Stashable Entity Role
package Example; use Moo; extends 'Nano::Node'; with 'Nano::Stash'; sub bestie { my ($self, @args) = @_; return $self->stash('bestie', @args); } package main; my $example = Example->new; # $example->bestie($example);
This package provides an entity-stashing role, useful for the ad-hoc persisting of Nano::Node entities. This role also makes it possible to save/load circularly dependent entities.
This package uses type constraints from:
Nano::Types
This package has the following attributes:
stashed(HashRef)
This attribute is read-only, accepts (HashRef) values, and is optional.
(HashRef)
This package implements the following methods:
get(Str $name) : Maybe[Node]
The get method finds and loads a previously stashed Nano::Node entity.
my $example = Example->new; my $bestie = $example->get('bestie');
my $example = Example->new; $example->bestie($example); $example->save; my $bestie = $example->get('bestie');
set(Str $name, Node $node) : Node
The set method stashes the Nano::Node entity provided by name. This does not save the subject or invocant.
my $example = Example->new; my $bestie = $example->set('bestie', $example);
stash(Str $name, Maybe[Node] $node) : Maybe[Node]
The stash method will "get" or "set" a stashed Nano::Node entity based on the arguments provided.
my $example = Example->new; my $bestie = $example->stash('bestie');
my $example = Example->new; $example->bestie($example); $example->save; my $bestie = $example->stash('bestie');
my $example = Example->new; my $bestie = $example->stash('bestie', $example);
Al Newkirk, awncorp@cpan.org
awncorp@cpan.org
Copyright (C) 2011-2019, Al Newkirk, et al.
This is free software; you can redistribute it and/or modify it under the terms of the The Apache License, Version 2.0, as elucidated in the "license file".
Wiki
Project
Initiatives
Milestones
Contributing
Issues
To install Nano, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Nano
CPAN shell
perl -MCPAN -e shell install Nano
For more information on module installation, please visit the detailed CPAN module installation guide.