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   1353 use strict;
  4         9  
  4         98  
2 4     4   19 use warnings;
  4         7  
  4         194  
3              
4             package Footprintless::Resource::Provider;
5             $Footprintless::Resource::Provider::VERSION = '1.26';
6             # ABSTRACT: A contract for providing resources to the resource manager
7             # PODNAME: Footprintless::Resource::Provider
8              
9 4     4   23 use parent qw(Footprintless::MixableBase);
  4         8  
  4         29  
10              
11 4     4   231 use Carp;
  4         8  
  4         233  
12 4         163 use Footprintless::Util qw(
13             temp_file
14 4     4   303 );
  4         8  
15 4     4   20 use Log::Any;
  4         8  
  4         37  
16              
17             my $logger = Log::Any->get_logger();
18              
19             sub download {
20 19     19 1 70 my ( $self, $resource, @options ) = @_;
21              
22 19         58 my $ref = ref($resource);
23 19 50 66     131 $resource = $self->resource($resource) if ( !$ref || $ref eq 'HASH' );
24              
25 19 50       169 croak("invalid resource [$resource]")
26             unless ( $resource->isa('Footprintless::Resource') );
27              
28 19         113 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__