File Coverage

blib/lib/Footprintless/Resource/Provider.pm
Criterion Covered Total %
statement 23 29 79.3
branch 2 4 50.0
condition 2 3 66.6
subroutine 7 10 70.0
pod 3 3 100.0
total 37 49 75.5


line stmt bran cond sub pod time code
1 4     4   1531 use strict;
  4         7  
  4         88  
2 4     4   16 use warnings;
  4         5  
  4         155  
3              
4             package Footprintless::Resource::Provider;
5             $Footprintless::Resource::Provider::VERSION = '1.28';
6             # ABSTRACT: A contract for providing resources to the resource manager
7             # PODNAME: Footprintless::Resource::Provider
8              
9 4     4   18 use parent qw(Footprintless::MixableBase);
  4         6  
  4         35  
10              
11 4     4   243 use Carp;
  4         7  
  4         237  
12 4         185 use Footprintless::Util qw(
13             temp_file
14 4     4   365 );
  4         14  
15 4     4   20 use Log::Any;
  4         8  
  4         34  
16              
17             my $logger = Log::Any->get_logger();
18              
19             sub download {
20 19     19 1 57 my ( $self, $resource, @options ) = @_;
21              
22 19         49 my $ref = ref($resource);
23 19 50 66     116 $resource = $self->resource($resource) if ( !$ref || $ref eq 'HASH' );
24              
25 19 50       82 croak("invalid resource [$resource]")
26             unless ( $resource->isa('Footprintless::Resource') );
27              
28 19         78 return $self->_download( $resource, @options );
29             }
30              
31             sub _download {
32 0     0     my ( $self, $resource, @options ) = @_;
33 0           croak( __PACKAGE__ . " does not support [$resource]" );
34             }
35              
36             sub resource {
37 0     0 1   my ( $self, $spec ) = @_;
38 0           croak( __PACKAGE__ . " does not support [$spec]" );
39             }
40              
41             sub supports {
42 0     0 1   my ( $self, $spec ) = @_;
43 0           return 0;
44             }
45              
46             1;
47              
48             __END__