3 BEGIN { pop @INC if $INC[-1] eq '.' }
10 getopts('h:', $opts) or die usage();
12 die usages() if $opts->{h};
14 ### need Text::Diff -- give a polite error (not a standard prereq)
15 unless ( eval { require Text::Diff; Text::Diff->import; 1 } ) {
16 die "\n\t This tool requires the 'Text::Diff' module to be installed\n";
19 my $arch = shift or die usage();
20 my $tar = Archive::Tar->new( $arch ) or die "Couldn't read '$arch': $!";
23 foreach my $file ( $tar->get_files ) {
24 next unless $file->is_file;
25 my $prefix = $file->prefix;
26 my $name = $file->name;
27 if (defined $prefix) {
28 $name = File::Spec->catfile($prefix, $name);
31 diff( \($file->get_content), $name,
32 { FILENAME_A => $name,
33 MTIME_A => $file->mtime,
45 Usage: ptardiff ARCHIVE_FILE
48 ptardiff is a small program that diffs an extracted archive
49 against an unextracted one, using the perl module Archive::Tar.
51 This effectively lets you view changes made to an archives contents.
53 Provide the progam with an ARCHIVE_FILE and it will look up all
54 the files with in the archive, scan the current working directory
55 for a file with the name and diff it against the contents of the
60 h Prints this help message
65 $ tar -xzf Acme-Buffy-1.3.tar.gz
66 $ vi Acme-Buffy-1.3/README
70 $ ptardiff Acme-Buffy-1.3.tar.gz > README.patch
85 ptardiff - program that diffs an extracted archive against an unextracted one
89 ptardiff is a small program that diffs an extracted archive
90 against an unextracted one, using the perl module Archive::Tar.
92 This effectively lets you view changes made to an archives contents.
94 Provide the progam with an ARCHIVE_FILE and it will look up all
95 the files with in the archive, scan the current working directory
96 for a file with the name and diff it against the contents of the
101 ptardiff ARCHIVE_FILE
104 $ tar -xzf Acme-Buffy-1.3.tar.gz
105 $ vi Acme-Buffy-1.3/README
107 $ ptardiff Acme-Buffy-1.3.tar.gz > README.patch
112 h Prints this help message
116 tar(1), L<Archive::Tar>.