Nano::Nodes
Persistable Index Super Class
use Nano::Nodes; my $nodes = Nano::Nodes->new( type => 'Nano::Node', ); # $nodes->save;
This package provides a persistable index super class. It is meant to be subclassed but can be used directly as well.
This package inherits behaviors from:
Nano::Node
This package uses type constraints from:
Nano::Types
This package has the following attributes:
scopes(ArrayRef[CodeRef])
This attribute is read-only, accepts (ArrayRef[CodeRef]) values, and is optional.
(ArrayRef[CodeRef])
type(Str)
This attribute is read-only, accepts (Str) values, and is required.
(Str)
This package implements the following methods:
add(HashRef $data) : Object
The add method creates a new object, adds it to the index, and returns the created object.
# given: synopsis my $node = $nodes->add({ rand => time });
all() : ArrayRef[Object]
The all method proxies to the attached Nano::Search instance and returns the results.
# given: synopsis my $all = $nodes->all;
count() : Int
The count method proxies to the attached Nano::Search instance and returns the results.
# given: synopsis my $count = $nodes->count;
del(Str $name) : Maybe[Object]
The del method removes the object from the index and returns the object (if found).
# given: synopsis my $result = $nodes->del('0000001');
drop() : Object
The drop method deletes the entire index and all of its indices.
# given: synopsis $nodes = $nodes->drop;
first() : Maybe[Object]
The first method proxies to the attached Nano::Search instance and returns the result.
# given: synopsis my $first = $nodes->first;
get(Str $name) : Maybe[Object]
The get method returns the object (based on ID) from the index (if found).
# given: synopsis my $result = $nodes->get('0000001');
last() : Maybe[Object]
The last method proxies to the attached Nano::Search instance and returns the result.
# given: synopsis my $last = $nodes->last;
next() : Maybe[Object]
The next method proxies to the attached Nano::Search instance and returns the result.
# given: synopsis my $next = $nodes->next;
prev() : Maybe[Object]
The prev method proxies to the attached Nano::Search instance and returns the result.
# given: synopsis my $prev = $nodes->prev;
scope(CodeRef $callback) : Object
The scope method registers a scope (search filter) and returns a new invocant instance.
# given: synopsis $nodes = $nodes->scope(sub { my ($node) = @_; !!$node->{active} });
search() : Search
The search method returns a Nano::Search object associated with the invocant.
# given: synopsis my $search = $nodes->search;
serialize() : HashRef
The serialize method returns a persistence representaton of the invocant.
# given: synopsis my $serial = $nodes->serialize;
set(Node $object) : Object
The set method adds the node object provided to the index and returns the provided object.
# given: synopsis use Nano::Node; my $node = Nano::Node->new(id => '0000003'); $node = $nodes->set($node);
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.