Apache::Wyrd::Site::Pull - Abstract class for Page Lists
#subclass Pull object to always ignore documents which have expired, #"expires" being an attribute of a Page object expressed in YYYYMMDD #form. package BASENAME::Pull; use base qw(Apache::Wyrd::Site::Pull); sub _date_fields { return ('published', 'expires'); } sub _require_fields { return qw(expires); } sub _doc_filter { my $self = shift; my @docs = @_; my $today = $self->_today_yyyymmdd; @docs = grep {$_->{expires} > $today} @docs; return @docs; }
Pull is an abstract ancestor class for NavPull and TagPull Wyrds which is used to apply rules for all page entries in a site index which are to be displayed on a page of that site. See Apache::Wyrd::Site for details.
(format: (returns) name (arguments after self))
_process_docs
Apply some transformation to every index entry. Accepts an array (as returned by Apache::Wyrd::Site::Index::search()), and returns a copy of the array with the transformation applied.
Apache::Wyrd::Site::Index::search()
The default transformation is to change every date field of the array into a human-readable form, as Apache::Wyrd::Interfaces::Dater::_date_string() and to delete any false-value keys, so that all Apache::Wyrd::Interfaces::Setter methods will work consistently. Generally, if you want to override this method in a subclass, you should finish with a call to the SUPER class unless you have made allowances for this need (i.e. $self-SUPER::_process_docs(@docs)>).
Apache::Wyrd::Interfaces::Setter
$self-
_date_fields
The array of fields that should be transformed from the standard YYYYMMDD string into human-readable dates. Default is the single field "published". Override this method to change this list.
_require_fields
The array of fields that must be in any entry requested from the site index. Generally, this is not necessary, since all fields are returned by default except those in _skip_fields.
_skip_fields
The array of fields that have no use to Pulls, and should not be included in the returned array of entries. Defaults to "data", "timestamp", and "digest", which are usually of interest only to the site index. (see Apache::Wyrd::Site::Index). Override this method to change this list.
Apache::Wyrd::Site::Index
_search_params
This returns the value of the parameter to send to the site index objects in order to apply the terms of _skip_fields and _require_fields. It is used by the TagPull and NavPull objects in their requests for an array of documents matching their criteria. Override only if you need to extend this distinction beyond _skip_fields and _require_fields.
_process_eventdate
If the index entry includes the field "eventdate", this method can be called in order to filter out items which do not fall within an event window. Note that "eventdate" is not one of the default attributes of Apache::Wyrd::Site::Page, and you will need to add it to the attributes list (see _attribs in the documentation for the Page Wyrd) as well as overriding the _process_docs method in order to include this method in the transformation.
Apache::Wyrd::Site::Page
_attribs
Where the pull's attribute is set to a date range in the standard eight-day form (see Apache::Wyrd::Interfaces::Dater) with a comma (i.e. eventdate="YYYYMMDD,YYYYMMDD"), the eventdate attribute of the page entry will be compared to this window, and if there is no overlap, the document will not appear in the Tag/NavPull.
Apache::Wyrd::Interfaces::Dater
Also acceptable as a value for eventdate is a positive or negative integer, indicating so many days in the future or the past.
If unset, the Pull's contents will be unaffected.
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Various index objects for site organization.
Base Wyrd for Web site pages
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.