Apache-Wyrd
view release on metacpan or search on metacpan
=back
In most cases, there will not be any need to override non-hook methods. For minor variations on Wyrd behavior, most
of the built-in Wyrds can be quickly extended by overriding the method with a method that calls the SUPER class:
sub _setup {
my $self = shift;
...do something here...
return $self->SUPER::_setup();
}
=head2 HTML ATTRIBUTES
Any legal attribute can generally be used. Some, however, are important
and are be reserved.
=head3 RESERVED ATTRIBUTES
=over
Wyrd/Cookie.pm view on Meta::CPAN
} else {
$data = CGI::Cookie->new(@_);
$data->{'_wyrd_req'} = $req;
}
bless $data, $class;
return $data;
}
sub bake {
my $self = shift;
return $self->SUPER::bake if ($have_apr);
my $req = $self->{'_wyrd_req'};
die('Cannot determine the Apache object. Perhaps you are attempting to bake a fetched cookie?')
unless (UNIVERSAL::isa($req, 'Apache'));
$req->err_headers_out->add("Set-Cookie" => ($self->as_string));
$req->headers_out->add("Set-Cookie" => ($self->as_string));
}
=pod
=head1 BUGS/CAVEATS/RESERVED METHODS
Wyrd/Input/Set.pm view on Meta::CPAN
=head1 LICENSE
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for C<Apache::Wyrd>.
=cut
sub _parse_options {
my ($self) = @_;
$self->SUPER::_parse_options;
my $options = $self->{'options'};
if (ref($options) eq 'ARRAY') {
use Apache::Wyrd::Input::Opt;
foreach my $option (@$options) {
my $object = Apache::Wyrd::Input::Opt->new($self->dbl, {value => $option});
$self->register_child($object);
}
} elsif (ref($options) eq 'HASH') {
use Apache::Wyrd::Input::Opt;
my ($name, $value) = ();
Wyrd/Site/Page.pm view on Meta::CPAN
=item etc., etc.,
Other indexible attributes may be added in subclasses. Note that the
attributes should be given as parameters to the index object (so it knows to
look for and store them). If the index object is SQL-type, the attributes
should be added to the underlying main table (normaly _wyrd_index), an
index_xxxxx method needs to be made to properly supply that value to the
index, and either the more_info method be defined to add all the data from
these attributes to the data fingerprint, or the index_digest call
SUPER::index_digest with the additional data as an argument (single scalar).
See C<Apache::Wyrd::Services::Index> and
C<Apache::Wyrd::Interfaces::Indexible>.
=back
=head2 FLAGS
=over
=item nofail
Wyrd/Site/Page.pm view on Meta::CPAN
As in C<Apache::Wyrd::Interfaces::Indexable>, provides the raw data to be
considered in generating the "fingerprint" that is used to determine if this
page has been changed, and consequently requires re-indexing.
=cut
sub index_digest {
my ($self, $extra) = @_;
$extra ||= '';
return $self->SUPER::index_digest(
$self->index_parent
. $self->index_published
. $self->index_section
. $self->index_allow
. $self->index_deny
. $self->index_tags
. $self->index_doctype
. $self->index_expires
. $self->index_longdescription
Wyrd/Site/Page.pm view on Meta::CPAN
attribute if set, to allow the page to proxy for another document.
=cut
#handled by Indexable: name reverse timestamp digest data count title keywords description
#Abstract Page attributes: parent file published section allow deny tags children
sub index_name {
my ($self) = @_;
return $self->{'original'} || $self->SUPER::index_name();
}
sub index_parent {
my ($self) = @_;
return $self->{'parent'};
}
sub index_file {
my ($self) = @_;
return $self->dbl->self_path;
Wyrd/Site/Page.pm view on Meta::CPAN
$description =~ s/\s+/ /g;
$template = $self->_set({title => strip_html($title), keywords => strip_html($keywords), description => strip_html($description)}, $template);
$template .= $self->get_cached($file);
$self->_process_template($template);
return;
}
sub _generate_output {
my ($self) = @_;
$self->_dispose_index;
return $self->SUPER::_generate_output;
}
=pod
=head1 AUTHOR
Barry King E<lt>wyrd@nospam.wyrdwright.comE<gt>
=head1 SEE ALSO
Wyrd/Site/Pull.pm view on Meta::CPAN
Apply some transformation to every index entry. Accepts an array (as
returned by C<Apache::Wyrd::Site::Index::search()>), and returns a copy of
the array with the transformation applied.
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
C<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. C<$self->SUPER::_process_docs(@docs)>).
=cut
sub _process_docs {
my ($self, @docs) = @_;
my @out = ();
foreach my $doc (@docs) {
foreach my $key (keys(%$doc)) {
$$doc{$key} = $self->_date_string(split(/[,-]/, $$doc{$key})) if (grep {$_ eq $key} $self->_date_fields);
delete $$doc{$key} unless ($$doc{$key});#undefine missing bits for setter
( run in 2.524 seconds using v1.01-cache-2.11-cpan-49f99fa48dc )