App-Tel

 view release on metacpan or  search on metacpan

local/lib/perl5/Module/Install/Admin/Manifest.pm  view on Meta::CPAN

package Module::Install::Admin::Manifest;

use strict;
use Module::Install::Base;

use vars qw{$VERSION @ISA};
BEGIN {
	$VERSION = '1.16';
	@ISA     = qw{Module::Install::Base};
}

use Cwd ();
use File::Spec;

# XXX I really want this method in Module::Install::Admin::Makefile
# But you can't call across Admin modules. Audrey??
sub dist_preop {
	my ($self, $distdir) = @_;
	return if $self->check_manifest;
	print <<"END_MESSAGE";

It appears that your MANIFEST does not contain the same components that
are currently in the 'inc' directory. 

Please try running 'make manifest' and then run 'make dist' again.

Remember to use the MANIFEST.SKIP file to control things that should not
end up in your MANIFEST. See 'perldoc ExtUtils::Manifest' for details.

END_MESSAGE
	return if $self->prompt(
		'Do you *really* want to continue making a distribution?', 'n'
	) =~ /^[Yy]/;

	if ( -d $distdir ) {
		require File::Path;
		File::Path::rmtree($distdir);
	}

	exit(1);
}

# XXX Needs a refactoring.
sub check_manifest {
	my $self = shift;
	my $prefix = $self->_top->{prefix};
	my ($manifest, $manifest_path, $relative_path) = $self->_read_manifest or return;
	my $manifest_skip = "$manifest_path.SKIP";
	my @skip;

	if ( -f "$manifest_path.SKIP" ) {
		open SKIP, $manifest_skip 
			or die "Can't open $manifest_skip for input:\n$!";
		@skip = map {chomp; $_} <SKIP>;
		close SKIP;
	}

	my %manifest;
	for ( my $i = 0; $i < @$manifest; $i++ ) {
		my $path = $manifest->[$i];
		$path =~ s/\s.*//;
		$path =~ s/^\.[\\\/]//;
		$path =~ s/[\\\/]/\//g;
		next unless $path =~ m/^\Q$prefix\E\b/i;
		$manifest{$path} = \$manifest->[$i];
	}

	ADDLOOP:
	for my $pathname ( sort $self->_find_files($prefix) ) {
		$pathname = "$relative_path/$pathname" if length($relative_path);
		$pathname =~ s!//+!/!g;
		next unless -f $pathname;
		if ( defined $manifest{$pathname} ) {
			delete $manifest{$pathname};
		} else {
			for ( @skip ) {
				next ADDLOOP if $pathname =~ /$_/;
			}
			return 0;
		}
	}
	if ( keys %manifest ) {
		foreach ( keys %manifest ) {
			print "Found extra file $_\n";
		}
		return 0;
	}
	return 1;
}

sub _read_manifest {



( run in 0.629 second using v1.01-cache-2.11-cpan-6aa56a78535 )