File Coverage

blib/lib/Parse/Flexget.pm
Criterion Covered Total %
statement 23 26 88.4
branch 5 8 62.5
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 35 41 85.3


line stmt bran cond sub pod time code
1             package Parse::Flexget;
2 2     2   117566 use strict;
  2         9  
  2         59  
3              
4             BEGIN {
5 2     2   10 use Exporter;
  2         3  
  2         79  
6 2     2   12 use vars qw($VERSION @ISA @EXPORT_OK);
  2         4  
  2         155  
7              
8 2     2   6 $VERSION = '0.016';
9 2         25 @ISA = qw(Exporter);
10              
11 2         51 @EXPORT_OK = qw(
12             flexparse
13             );
14             }
15              
16 2     2   11 use Carp qw(croak);
  2         4  
  2         383  
17              
18             sub flexparse {
19 1     1 1 85 my @data;
20 1 50       6 if(ref($_[0]) eq 'ARRAY') {
    50          
21 0         0 push(@data, @{$_[0]});
  0         0  
22             }
23             elsif(ref($_[0]) eq '') {
24 1         10 push(@data, @_);
25             }
26             else {
27 0         0 croak("Reference type " . ref($_[0]) . " not supported\n");
28             }
29              
30 1         2 my @downloads;
31 1         2 for my $element(@data) {
32 44 100       66 if($element =~ m/Downloading: (\S+)/) {
33 1         3 push(@downloads, $1);
34             }
35             }
36 1 50       6 return wantarray() ? @downloads : scalar(@downloads);
37             }
38              
39              
40             1;
41              
42             __END__