View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Jon Portnoy (PAUSE Custodial Account) > IRC-Indexer > IRC::Indexer::POD::ClientExamples


Annotate this POD

View/Report Bugs


IRC::Indexer::POD::ClientExamples - Example indexer frontends


This document offers some possible methods of putting IRC::Indexer trawler output to use.

Be sure to also see the examples/ directory in the distribution.


ircindexer-server-json can be used to manage a set of trawlers, exporting JSON over HTTP for use by frontends.

Note that server-json only reports networks & servers that have been trawled in the current instance. It is up to frontends to handle persistency and storage.

Assuming your ircindexer-server-json is running on port 8700 on localhost:

Retrieve available networks

  use LWP::UserAgent;
  use JSON::XS;
  my $response = LWP::UserAgent->new()->get(
  my $networks;
  if ($response->success) {
    my $json = $response->content;
    $networks = decode_json($json);
  } else {
    ## Retrieving JSON failed ...
    ## You can check for $response->code == 404
    ## If the content() of the 404 starts with "PENDING" the trawl 
    ## run is waiting for a successful completion; otherwise it is 
    ## not an available network.
    ## ... or just die()   :-)

Now $networks contains an array reference listing available network names. We can use that to retrieve a specific network's information:

  for my $netname (@$networks) {
    my $response = LWP::UserAgent->new()->get(
    my $netinfo;
    if ($response->success) {
      my $json = $response->content;
      $netinfo = decode_json($json);

The 'netinfo' hash adheres to the format specified by IRC::Indexer::POD::NetworkSpec.

Retrieve available servers

A similar technique can be used to get the currently available trawled servers, given a valid $netname:

  my $response = LWP::UserAgent->new()->get(
  my $servlist;
  if ($response->success) {
    my $json = $response->content;
    $servlist = decode_json($json);

The servlist allows you to retrieve specific server hashes, as detailed in IRC::Indexer::POD::ServerSpec:

  for my $server (@$servlist) {
    my $response = LWP::UserAgent->new()->get(
    my $servinfo;
    ## decode, same as above


Jon Portnoy <>

syntax highlighting: