CGI-Session
view release on metacpan or search on metacpan
# $Id: Build.PL 336 2006-10-26 02:17:31Z markstos $
use strict;
use File::Spec;
use Module::Build;
use Text::Wrap;
# ------------------------------------------------
sub create_changelog_ini
{
my($error);
eval "require Module::Metadata::Changes";
if ($@)
{
$error = $@;
}
else
{
# Ensure Changelog.ini is writable.
if (-e 'Changelog.ini' && ! -w 'Changelog.ini')
{
$error = (chmod 0200, 'Changelog.ini' == 0) ? 'Could not make Changelog.ini writable' : '';
}
if (! $error)
{
eval
{
print "Regenerating Changelog.ini...\n";
`ini.report.pl -c -i Changes`;
if (! -e 'Changelog.ini')
{
# Warning: Can't use $@ to carry msg out of block(s).
$error = 'Failed to generate Changelog.ini';
}
else
{
my(@stat) = stat 'Changelog.ini';
# Was the file modified in the last 2 seconds?
if ( (time() - $stat[9]) < 2)
{
# Yes. Do nothing.
}
else
{
$error = 'Failed to update Changelog.ini';
}
}
};
if ($@)
{
$error = $@;
}
}
}
# We ignore the precise value of $@ here.
if ($error)
{
print "Warning: Module::Metadata::Changes's ini.report.pl failed to generate or update Changelog.ini. \n";
}
else
{
print "Changelog.ini generated or updated. \n";
}
} # End of create_changelog_ini.
# ------------------------------------------------
# Some of the scripts need ./t/sessiondata to be present.
mkdir(File::Spec->catfile('t', 'sessiondata'));
print "-" x 40, "\n";
( run in 1.238 second using v1.01-cache-2.11-cpan-39bf76dae61 )