File Coverage

blib/lib/Tapper/Producer.pm
Criterion Covered Total %
statement 8 10 80.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 12 14 85.7


line stmt bran cond sub pod time code
1             package Tapper::Producer;
2             # git description: v4.1.2-2-gb3a4473
3              
4             BEGIN {
5 1     1   82784 $Tapper::Producer::AUTHORITY = 'cpan:TAPPER';
6             }
7             {
8             $Tapper::Producer::VERSION = '4.1.3';
9             }
10             # ABSTRACT: Tapper - Precondition producers (base class)
11              
12 1     1   10 use warnings;
  1         2  
  1         29  
13 1     1   8 use strict;
  1         2  
  1         47  
14              
15 1     1   517 use Moose;
  0            
  0            
16              
17              
18             sub produce
19             {
20             my ($self, $job, $precond_hash) = @_;
21              
22             my $producer_name = $precond_hash->{producer};
23              
24             eval "use Tapper::Producer::$producer_name"; ## no critic (ProhibitStringyEval)
25             die "Can not load producer '$producer_name': $@" if $@;
26              
27             my $producer = "Tapper::Producer::$producer_name"->new();
28             return $producer->produce($job, $precond_hash);
29             }
30              
31             1; # End of Tapper::Producer
32              
33             __END__
34              
35             =pod
36              
37             =encoding utf-8
38              
39             =head1 NAME
40              
41             Tapper::Producer - Tapper - Precondition producers (base class)
42              
43             =head1 Functions
44              
45             =head2 produce
46              
47             Get the requested producer, call it and return the new precondition(s)
48             returned by it.
49              
50             @param testrunscheduling result object - testrun this precondition belongs to
51             @param hash ref - producer precondition
52              
53             @return success - hash ref containing list of new preconditions and a
54             new topic (optional)
55              
56             @throws die()
57              
58             =head1 AUTHOR
59              
60             AMD OSRC Tapper Team <tapper@amd64.org>
61              
62             =head1 COPYRIGHT AND LICENSE
63              
64             This software is Copyright (c) 2013 by Advanced Micro Devices, Inc..
65              
66             This is free software, licensed under:
67              
68             The (two-clause) FreeBSD License
69              
70             =cut