| WWW-Opentracker-Stats documentation | Contained in the WWW-Opentracker-Stats distribution. |
WWW::Opentracker::Stats::Mode::Torr
Parses the torr statistics from opentracker.
Args: $self, $payload
Decodes the plain text data retrieved from the torr statistics of opentracker. Only the number of torrents is available from this statistics.
The payload looks like this (no indentation): 2 0 opentracker serving 2 torrents opentracker
Knut-Olav Hoven, <knutolav@gmail.com>
Copyright (C) 2009 by Knut-Olav Hoven
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
| WWW-Opentracker-Stats documentation | Contained in the WWW-Opentracker-Stats distribution. |
package WWW::Opentracker::Stats::Mode::Torr; use strict; use warnings; use parent qw/ WWW::Opentracker::Stats::Mode Class::Accessor::Fast /; __PACKAGE__->_format('txt'); __PACKAGE__->_mode('torr'); __PACKAGE__->mk_accessors(qw/_stats/);
sub parse_stats { my ($self, $payload) = @_; # To support thousand delimiters my ($raw_torrents, undef, undef) = $payload =~ m{\A ([\d\'\.]+) \s ([\d\'\.]+) \s opentracker \s serving \s ([\d\'\.]+) \s torrents \s opentracker }xms or die "Unable to parse payload: $payload"; my %stats = ( 'torrents' => $self->parse_thousands($raw_torrents), ); return \%stats; }
1;