File Coverage

blib/lib/Dist/Metadata/Tar.pm
Criterion Covered Total %
statement 27 27 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod 3 4 75.0
total 39 40 97.5


line stmt bran cond sub pod time code
1             # vim: set ts=2 sts=2 sw=2 expandtab smarttab:
2             #
3             # This file is part of Dist-Metadata
4             #
5             # This software is copyright (c) 2011 by Randy Stauner.
6             #
7             # This is free software; you can redistribute it and/or modify it under
8             # the same terms as the Perl 5 programming language system itself.
9             #
10 4     4   572 use strict;
  4         5  
  4         125  
11 4     4   16 use warnings;
  4         5  
  4         278  
12              
13             package Dist::Metadata::Tar;
14             our $AUTHORITY = 'cpan:RWSTAUNER';
15             # ABSTRACT: Enable Dist::Metadata for tar files
16             $Dist::Metadata::Tar::VERSION = '0.926';
17 4     4   2560 use Archive::Tar 1 (); # 0.07 isn't good enough
  4         352035  
  4         115  
18 4     4   37 use Carp (); # core
  4         5  
  4         60  
19 4     4   499 use parent 'Dist::Metadata::Archive';
  4         215  
  4         28  
20              
21             push(@Dist::Metadata::CARP_NOT, __PACKAGE__);
22              
23             sub file_content {
24 23     23 1 51 my ( $self, $file ) = @_;
25 23         133 return $self->archive->get_content( $self->full_path($file) );
26             }
27              
28             sub find_files {
29 11     11 1 18 my ($self) = @_;
30             return
31 35         850 map { $_->full_path }
  35         368  
32 11         52 grep { $_->is_file }
33             $self->archive->get_files;
34             }
35              
36             sub read_archive {
37 12     12 1 617 my ($self, $file) = @_;
38              
39 12         75 my $archive = Archive::Tar->new();
40 12         165 $archive->read($file);
41              
42 12         43731 return $archive;
43             }
44              
45             sub tar {
46 1     1 0 10 warn __PACKAGE__ . '::tar() is deprecated. Use archive() instead.';
47 1         12 return $_[0]->archive;
48             }
49              
50             1;
51              
52             __END__