PGXN-API

 view release on metacpan or  search on metacpan

lib/PGXN/API/Indexer.pm  view on Meta::CPAN

    map { $_ => [] } qw(docs dists extensions users tags)
} });

has _user_names => (is => 'ro', isa => 'HashRef', default => sub { +{ } });

has libxml   => (is => 'ro', isa => 'XML::LibXML', lazy => 1, default => sub {
    XML::LibXML->new(
        recover    => 2,
        no_network => 1,
        no_blanks  => 1,
        no_cdata   => 1,
    );
});

has index_dir => (is => 'ro', isa => 'Str', lazy => 1, default => sub {
    my $dir = catdir +PGXN::API->instance->doc_root, '_index';
    if (!-e $dir) {
        require File::Path;
        File::Path::make_path($dir);
    }
    $dir;

t/docs.t  view on Meta::CPAN

use File::Basename;
use File::Spec::Functions qw(catfile catdir tmpdir);
use Encode qw(encode_utf8);
use utf8;

my $indexer = new_ok 'PGXN::API::Indexer';
my $libxml = XML::LibXML->new(
    recover    => 2,
    no_network => 1,
    no_blanks  => 1,
    no_cdata   => 1,
);

# Unfortunately, we have to write to a file, because file_contents_eq_or_diff
# doesn't seem to work on Windows.
my $tmpfile = catfile tmpdir, 'pgxnapi-doctest$$.html';

END { unlink $tmpfile }

for my $in (glob catfile qw(t htmlin *)) {
    my $doc = $libxml->parse_html_file($in, {



( run in 0.527 second using v1.01-cache-2.11-cpan-454fe037f31 )