Robert Spier wrote:
>
> I need a script that meets the following specs:
>
> Input (via command line)
> 1) file representing MANIFEST
> 2) file representing MANIFEST.SKIP
> 3) file representing list of all files found
>
> Output (via stdout)
> error message if manifest check fails
>
> Restrictions:
> The script cannot access any other files/filesystems/directory
> listings besides the data in the files provided on the command
> line.
>
> I think the easiest to implement this is by subclassing
> ExtUtils::Manifest, and overriding manifiles() and maybe one or two
> other subroutines.
I assume you can probably yank the Mac and VMS stuff... but left it in
anyway.
Garrett
#!/usr/bin/perl
use ExtUtils::Manifest;
die "expected 3 args" unless 3 == @ARGV;
-f or die "file not found: $_" for @ARGV;
my $found = {};
my $Is_MacOS = $^O eq 'MacOS';
my $Is_VMS = $^O eq 'VMS';
require VMS::Filespec if $Is_VMS;
$ExtUtils::Manifest::MANIFEST = shift;
my $read = ExtUtils::Manifest::maniread() || {};
$ExtUtils::Manifest::DEFAULT_MSKIP = shift;
my $skip = ExtUtils::Manifest::_maniskip();
open IN, shift;
/^(.*)$/ and $found->{$1}++ while (<IN>);
close IN;
# _check_manifest
foreach my $file (sort keys %$found){
next if $skip->($file);
unless ( exists $read->{$file} ) {
my $canon = $Is_MacOS
? "\t".ExtUtils::Manifest::_unmacify($file)
: '';
warn "Not in $ExtUtils::Manifest::MANIFEST: $file$canon\n";
}
}
# _check_files
foreach my $file (sort keys %$read) {
warn "No such file: $file\n" unless exists $found->{$file}
}
1;
__END__
--
Garrett Goebel
IS Development Specialist
ScriptPro Direct: 913.403.5261
5828 Reeds Road Main: 913.384.1008
Mission, KS 66202 Fax: 913.384.2180
www.scriptpro.com garrett at scriptpro dot com