Created
December 1, 2010 02:06
-
-
Save dagolden/722806 to your computer and use it in GitHub Desktop.
M::B create_mymeta
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub create_mymeta { | |
my ($self) = @_; | |
my $mymetafile = $self->mymetafile; | |
my $metafile = $self->metafile; | |
# cleanup | |
if ( $self->delete_filetree($mymetafile) ) { | |
$self->log_verbose("Removed previous '$mymetafile'\n"); | |
} | |
$self->log_info("Creating new '$mymetafile' with configuration results\n"); | |
# use old meta and update prereqs, if possible | |
my $mymeta; | |
if ( -f $metafile ) { | |
$mymeta = eval { $self->read_metafile( $self->metafile ) }; | |
} | |
# if we read META OK, just update it | |
if ( defined $mymeta ) { | |
my $prereqs = $self->_normalize_prereqs; | |
for my $t ( 'configure_requires', @{$self->prereq_action_types} ) { | |
$mymeta->{$t} = $prereqs->{$t} if $prereqs->{$t}; | |
} | |
} | |
# but generate from scratch, ignoring errors if META doesn't exist | |
else { | |
$mymeta = $self->get_metadata( fatal => 0 ); | |
} | |
# MYMETA is always static | |
$mymeta->{dynamic_config} = 0; | |
# Note which M::B created it | |
$mymeta->{generated_by} = "Module::Build version $Module::Build::VERSION"; | |
$self->write_metafile( $mymetafile, $mymeta ); | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment