[Module-build-checkins] CPANPLUS-Dist-Build/lib/CPANPLUS/Dist Build.pm,1.6,1.7
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <kwi...@us...> - 2005-09-12 19:58:16
|
Update of /cvsroot/module-build/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29198/lib/CPANPLUS/Dist Modified Files: Build.pm Log Message: A patch from Jos to allow the caller to filter the prereq list Index: Build.pm =================================================================== RCS file: /cvsroot/module-build/CPANPLUS-Dist-Build/lib/CPANPLUS/Dist/Build.pm,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Build.pm 12 Sep 2005 19:57:14 -0000 1.6 +++ Build.pm 12 Sep 2005 19:58:07 -0000 1.7 @@ -335,15 +335,29 @@ my $dist = shift; my $mb = $dist->status->_mb_object; my $self = $dist->parent; + my $cb = $self->parent; my $prereqs = {}; foreach my $type ('requires', 'build_requires') { my $p = $mb->$type() || {}; $prereqs->{$_} = $p->{$_} foreach keys %$p; } - $self->status->prereqs( $prereqs ); - return $prereqs; + ### allows for a user defined callback to filter the prerequisite + ### list as they see fit, to remove (or add) any prereqs they see + ### fit. The default installed callback will return the hashref in + ### an unmodified form + ### this callback got added after cpanplus 0.0562, so use a 'can' + ### to find out if it's supported. For older versions, we'll just + ### return the hashref as is ourselves. + my $href = $cb->_callbacks->can('filter_prereqs') + ? $cb->_callbacks->filter_prereqs->( $cb, $prereqs ) + : $prereqs; + + $self->status->prereqs( $href ); + + ### make sure it's not the same ref + return { %$href }; } =pod |