Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ppi::cache(3) [mojave man page]

PPI::Cache(3)						User Contributed Perl Documentation					     PPI::Cache(3)

NAME
PPI::Cache - The PPI Document Caching Layer SYNOPSIS
# Set the cache use PPI::Cache path => '/var/cache/ppi-cache'; # Manually create a cache my $Cache = PPI::Cache->new( path => '/var/cache/perl/class-PPI', readonly => 1, ); DESCRIPTION
"PPI::Cache" provides the default caching functionality for PPI. It integrates automatically with PPI itself. Once enabled, any attempt to load a document from the filesystem will be cached via cache. Please note that creating a PPI::Document from raw source or something other object will not be cached. Using PPI::Cache The most common way of using "PPI::Cache" is to provide parameters to the "use" statement at the beginning of your program. # Load the class but do not set a cache use PPI::Cache; # Use a fairly normal cache location use PPI::Cache path => '/var/cache/ppi-cache'; Any of the arguments that can be provided to the "new" constructor can also be provided to "use". METHODS
new param => $value, ... The "new" constructor creates a new standalone cache object. It takes a number of parameters to control the cache. path The "path" param sets the base directory for the cache. It must already exist, and must be writable. readonly The "readonly" param is a true/false flag that allows the use of an existing cache by a less-privileged user (such as the web user). Existing documents will be retrieved from the cache, but new documents will not be written to it. Returns a new "PPI::Cache" object, or dies on error. path The "path" accessor returns the path on the local filesystem that is the root of the cache. readonly The "readonly" accessor returns true if documents should not be written to the cache. get_document $md5sum | $source The "get_document" method checks to see if a Document is stored in the cache and retrieves it if so. store_document $Document The "store_document" method takes a PPI::Document as argument and explicitly adds it to the cache. Returns true if saved, or "undef" (or dies) on error. FIXME (make this return either one or the other, not both) TO DO
- Finish the basic functionality - Add support for use PPI::Cache auto-setting $PPI::Document::CACHE SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2005 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.18.2 2011-02-25 PPI::Cache(3)

Check Out this Related Man Page

PPI::Document::Normalized(3pm)				User Contributed Perl Documentation			    PPI::Document::Normalized(3pm)

NAME
PPI::Document::Normalized - A normalized Perl Document DESCRIPTION
A "Normalized Document" object is the result of the normalization process contained in the PPI::Normal class. See the documentation for PPI::Normal for more information. The object contains a version stamp and function list for the version of PPI::Normal used to create it, and a processed and delinked PPI::Document object. Typically, the Document object will have been mangled by the normalization process in a way that would make it fatal to try to actually DO anything with it. Put simply, never use the Document object after normalization. YOU HAVE BEEN WARNED! The object is designed the way it is to provide a bias towards false negatives. A comparison between two ::Normalized object will only return true if they were produced by the same version of PPI::Normal, with the same set of normalization functions (in the same order). You may get false negatives if you are caching objects across an upgrade. Please note that this is done for security purposes, as there are many cases in which low layer normalization is likely to be done as part of a code security process, and false positives could be highly dangerous. METHODS
new The "new" method is intended for use only by the PPI::Normal class, and to get ::Normalized objects, you are highly recommended to use either that module, or the "normalized" method of the PPI::Document object itself. version The "version" accessor returns the PPI::Normal version used to create the object. functions The "functions" accessor returns a reference to an array of the normalization functions (in order) that were called when creating the object. equal $Normalized The "equal" method is the primary comparison method, taking another PPI::Document::Normalized object, and checking for equivalence to it. The "==" operator is also overload to this method, so that you can do something like the following: my $first = PPI::Document->load('first.pl'); my $second = PPI::Document->load('second.pl'); if ( $first->normalized == $second->normalized ) { print "The two documents are equivalent"; } Returns true if the normalized documents are equivalent, false if not, or "undef" if there is an error. SUPPORT
See the support section in the main module. AUTHOR
Adam Kennedy <adamk@cpan.org> COPYRIGHT
Copyright 2005 - 2011 Adam Kennedy. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The full text of the license can be found in the LICENSE file included with this module. perl v5.10.1 2011-02-26 PPI::Document::Normalized(3pm)
Man Page