MrGamoo/AC/ReadInput.pm untested

filter: Statementstmt 0.0% 0 / 25 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 39 CC 5 SCAR 28.7
CC
5
Cov
0%
readinput
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 17.6
1 # -*- perl -*-
2  
3 # Copyright (c) 2010 AdCopy
4 # Author: Jeff Weisberg
5 # Created: 2010-Jan-26 12:04 (EST)
6 # Function: read input - dancr log format
7 #
8 # $Id: ReadInput.pm,v 1.1 2010/11/01 18:41:49 jaw Exp $
9  
10 package AC::MrGamoo::AC::ReadInput;
11 use AC::Logfile;
12 use AC::Daemon;
13 use AC::MrGamoo::User;
14 use strict;
15  
16 our $R; # exported by AC::MrGamoo::User
17  
18 sub readinput {
19 my $fd = shift;
20  
21 my $line = scalar <$fd>;
22 return (undef, 1) unless defined $line;
23  
24 my $d;
25 eval { $d = parse_dancr_log($line); };
26 if( $@ ){
27 problem("cannot parse data in (" . $R->config('current_file') . "). cannot process\n");
28 return ;
29 }
30  
31 # filter input on date range. we could just as easily filter
32 # in 'map', but doing here, behind the scenes, keeps things
33 # simpler for the jr. developers writing reports.
34 return if $d->{tstart} < $R->config('start');
35 return if $d->{tstart} >= $R->config('end');
36  
37 return ($d, 0);
38 }
39  
40 1;