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   1601 use strict;
  4         8  
  4         92  
2 4     4   16 use warnings;
  4         4  
  4         148  
3              
4             package Footprintless::Resource::Provider;
5             $Footprintless::Resource::Provider::VERSION = '1.29';
6             # ABSTRACT: A contract for providing resources to the resource manager
7             # PODNAME: Footprintless::Resource::Provider
8              
9 4     4   24 use parent qw(Footprintless::MixableBase);
  4         7  
  4         34  
10              
11 4     4   224 use Carp;
  4         7  
  4         191  
12 4         199 use Footprintless::Util qw(
13             temp_file
14 4     4   383 );
  4         8  
15 4     4   19 use Log::Any;
  4         8  
  4         36  
16              
17             my $logger = Log::Any->get_logger();
18              
19             sub download {
20 19     19 1 70 my ( $self, $resource, @options ) = @_;
21              
22 19         49 my $ref = ref($resource);
23 19 50 66     114 $resource = $self->resource($resource) if ( !$ref || $ref eq 'HASH' );
24              
25 19 50       96 croak("invalid resource [$resource]")
26             unless ( $resource->isa('Footprintless::Resource') );
27              
28 19         85 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__