#!/bin/bash

cd $(dirname $0);

[ -e Makefile ] && make distclean;

 tmp='lib/FindBin/libs.tmp';
dest='lib/FindBin/libs.pm';
mkdir -p $(dirname $dest);

rm -fv t/0*t;

placeholder()
{
    cat <<END > $tmp;
$( grep '^package' $dest)

sub import
{

    die <<'MSG';
This is a placeholder.
Please execute "perl Makefile.PL" in the
module's distribution directory in order
to have the correct file(s) installed.
MSG

}
1
__END__
=head1 PLACEHOLDER

This is a placeholder.

The correct files are copied as part of processing the Makefile.PL.
END

mv -v $tmp $dest;

}

# now that the dummy file is installed, genrate the dist.

perl Makefile.PL        &&
make test               &&
make disttest           &&
placeholder             &&
make dist               &&
mv -v *.tar.gz /var/tmp ;

exit 0;