File Coverage

blib/lib/Parse/IRCLog/Result.pm
Criterion Covered Total %
statement 14 14 100.0
branch 2 4 50.0
condition n/a
subroutine 4 4 100.0
pod 2 2 100.0
total 22 24 91.6


line stmt bran cond sub pod time code
1 4     4   21 use strict;
  4         6  
  4         132  
2 4     4   19 use warnings;
  4         8  
  4         594  
3             package Parse::IRCLog::Result;
4             # ABSTRACT: results of parsing an IRC logfile
5             $Parse::IRCLog::Result::VERSION = '1.106';
6             # =head1 SYNOPSIS
7             #
8             # use Parse::IRCLog;
9             #
10             # $result = Parse::IRCLog->parse("perl-2004-02-01.log");
11             #
12             # my %to_print = ( msg => 1, action => 1 );
13             #
14             # for ($result->events) {
15             # next unless $to_print{ $_->{type} };
16             # print "$_->{nick}: $_->{text}\n";
17             # }
18             #
19             # =head1 DESCRIPTION
20             #
21             # See L. This module describes the result of parsing.
22             #
23             # =method new
24             #
25             # my $result = $class->new(@events);
26             #
27             # This method is not user-serviceable. It is called by Parse::IRCLog to create
28             # the Result object.
29             #
30             # =cut
31              
32             sub new {
33 1     1 1 2 my $class = shift;
34 1         2 my @events = @_;
35 1 50       11 return if ref $class;
36 1 50       591 return unless @events;
37              
38 1         31 bless { events => \@events } => $class;
39             }
40              
41             # =method events
42             #
43             # This method returns the list of events in the result set.
44             #
45             # =cut
46              
47             sub events {
48 1     1 1 536 my $self = shift;
49 1         1 @{$self->{events}};
  1         11  
50             }
51              
52             # =head1 TODO
53             #
54             # Provide iterator functionality. Five minutes of looking didn't find a mixin
55             # class for iterators, so I might end up just delegating iterator methods to a
56             # tied array object or something. This can wait.
57             #
58             # =cut
59              
60             1;
61              
62             __END__