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   108381 use strict;
  2         12  
  2         54  
3              
4             BEGIN {
5 2     2   9 use Exporter;
  2         2  
  2         72  
6 2     2   10 use vars qw($VERSION @ISA @EXPORT_OK);
  2         2  
  2         183  
7              
8 2     2   5 $VERSION = '0.018';
9 2         25 @ISA = qw(Exporter);
10              
11 2         47 @EXPORT_OK = qw(
12             flexparse
13             );
14             }
15              
16 2     2   11 use Carp qw(croak);
  2         3  
  2         372  
17              
18             sub flexparse {
19 1     1 1 95 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         11 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         3 for my $element(@data) {
32 44 100       67 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__