Jon Portnoy > IRC-Indexer-0.06 > IRC::Indexer::Report::Server

Download:
IRC-Indexer-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

IRC::Indexer::Report::Server - Server information class for IRC::Indexer

SYNOPSIS ^

  ## Create new blank server info obj:
  my $info = IRC::Indexer::Report::Server->new;

  . . . add trawler data via methods .  . .
  
  ## Get server's info as hash:
  my $ref = $info->netinfo;
  
  ## Construct from previously-exported hash:
  my $info = IRC::Indexer::Report::Server->new(
    FromHash => $previous->netinfo(),
  );
  
  ## See below for other methods.

DESCRIPTION ^

Represents the results of a single trawled server.

This is the object returned by "info" in IRC::Indexer::Trawl::Bot -- it can be used to pull out specific pieces of information about a trawl run (or a complete dump), or fed to an IRC::Indexer::Report::Network to be merged into a network summary.

Methods

netinfo

Returns the entire NetInfo hash, as documented below ("netinfo hash").

clone

Returns a cloned copy of the current state of the NetInfo hash, as opposed to the reference returned by "netinfo".

If NoChannels is specified, HashChans and ListChans will be excluded from the cloned dump:

  my $without_chans = $info->clone(NoChannels => 1);

status

Get or set the current status.

Valid values are:

  undef     -- not started
  INIT      -- started
  CONNECTED -- connected to IRC
  FAIL      -- error encountered
  DONE      -- finished

failed

Get or set the current error string.

Should be boolean false if there have been no fatal errors.

startedat

Get or set the start timestamp (epoch seconds)

connectedat

Get or set the time the trawler connected to IRC.

finishedat

Get or set the time the trawler finished this run.

network

Get or set the network name; this is the name announced via ISUPPORT (NETWORK=). If the queried network doesn't announce NETWORK=, the server name will be supplied.

connectedto

Get or set the target server; this is the address the bot is trawling, not necessarily the announced server name (see "server")

server

Get or set the actual server name; this is the name announced by the server, not necessarily the address we originally connected to.

ircd

Get or set the server version.

blank_motd

Clear the existing MOTD.

motd

With no arguments, gets the current MOTD (or undef). This will be an array reference containing MOTD lines.

If an argument is specified, it is pushed to the end of the current MOTD array.

users

Get or set the current global user count, as reported by LUSERS.

opers

Get or set the current global oper count, as reported by LUSERS.

links

With no arguments, returns an array reference containing LINKS output (or undef).

If an argument is specified, it should be an array reference containing raw LINKS lines.

totalchans

Get the total number of channels found in LIST.

This is calculated from "chanhash" and cannot be set directly; use "add_channel" to add a channel.

channels

Returns an array of arrays, sorted by user count (highest first), of channel names and their respective user counts and topics:

  my $listchans = $info->channels;
  for my $item (@$listchans) {
    my ($name, $count, $topic) = @$item;
    . . .
  }

chanhash

Returns a hash, keyed on channel name, of the results of LIST.

Keys are Users and Topic:

  my $chans = $info->chanhash;
  for my $channel (keys %$chans) {
    my $this_chan = $chans->{$channel};
    my $user_count = $this_chan->{Users};
    my $last_topic = $this_chan->{Topic};
    . . . 
  }

add_channel

Used by trawlers to append a channel from LIST output.

Adds a channel to the channel hash (see "chanhash"):

  ## in a LIST handler:
  $info->add_channel($chan, $users, $topic);

netinfo hash

The netinfo method returns a hash with the following keys:

  Status
  Failure
  ConnectedTo
  ServerName
  NetName
  GlobalUsers
  OperCount
  ListLinks
  ListChans
  MOTD
  IRCD
  StartedAt
  ConnectedAt
  FinishedAt

These all roughly correspond to their respective accessors, documented above.

See IRC::Indexer::POD::ServerSpec for details.

AUTHOR ^

Jon Portnoy <avenj@cobaltirc.org>

syntax highlighting: