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   601 use strict;
  4         5  
  4         96  
11 4     4   11 use warnings;
  4         5  
  4         219  
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.927';
17 4     4   2421 use Archive::Tar 1 (); # 0.07 isn't good enough
  4         242132  
  4         97  
18 4     4   26 use Carp (); # core
  4         5  
  4         56  
19 4     4   391 use parent 'Dist::Metadata::Archive';
  4         201  
  4         27  
20              
21             push(@Dist::Metadata::CARP_NOT, __PACKAGE__);
22              
23             sub file_content {
24 23     23 1 33 my ( $self, $file ) = @_;
25 23         89 return $self->archive->get_content( $self->full_path($file) );
26             }
27              
28             sub find_files {
29 11     11 1 14 my ($self) = @_;
30             return
31 35         562 map { $_->full_path }
32 11         45 grep { $_->is_file }
  35         293  
33             $self->archive->get_files;
34             }
35              
36             sub read_archive {
37 12     12 1 330 my ($self, $file) = @_;
38              
39 12         68 my $archive = Archive::Tar->new();
40 12         139 $archive->read($file);
41              
42 12         37920 return $archive;
43             }
44              
45             sub tar {
46 1     1 0 15 warn __PACKAGE__ . '::tar() is deprecated. Use archive() instead.';
47 1         12 return $_[0]->archive;
48             }
49              
50             1;
51              
52             __END__