Apache-Wyrd
view release on metacpan or search on metacpan
Wyrd/Site/MySQLIndex.pm view on Meta::CPAN
package Apache::Wyrd::Site::MySQLIndex;
use strict;
use base qw(Apache::Wyrd::Services::MySQLIndex);
use Apache::Wyrd::Services::SAK qw(:file);
use HTTP::Request::Common;
our $VERSION = '0.98';
=pod
=head1 NAME
Apache::Wyrd::Site::MySQLIndex - Wrapper MySQLIndex for the Site classes
=head1 SYNOPSIS
Sample Implementation:
use base qw(Apache::Wyrd::Site::MySQLIndex);
my $dbh = _get_database_handle();
sub new {
my ($class) = @_;
my $init = {
dbh => $dbh,
debug => 0,
attributes => [qw(doctype meta)],
maps => [qw(meta)]
};
return &Apache::Wyrd::Site::Index::new($class, $init);
}
sub ua {
return BASENAME::UA->new;
}
sub skip_file {
my ($self, $file) = @_;
return 1 if ($file eq 'test.html');
return;
}
=head1 DESCRIPTION
This class extends the Apach::Wyrd::Site::Index class, so check the
documentation of that module for any methods. It provides an index of
Apache::Wyrd::Site::Page objects (see that module for details) using the
mysql backend instead of BerkeleyDB.
=over
=cut
sub get_children {
my ($self, $parent, $params) = @_;
if (!defined($parent)) {
return [];
}
$self->read_db;
my $sh = $self->db->prepare('select id, tally from _wyrd_index_children where item=?');
$sh->execute($parent);
my @ids = ();
my %rank = ();
while (my $data_ref = $sh->fetchrow_arrayref) {
my $id = $data_ref->[0];
( run in 1.549 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )