Created
March 27, 2010 06:07
-
-
Save madsen/345766 to your computer and use it in GitHub Desktop.
Dist::Zilla plugins for build & configure requires (pre DZ 2.x)
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
#--------------------------------------------------------------------- | |
package Dist::Zilla::Plugin::BuildReq; | |
# | |
# Copyright 2010 Christopher J. Madsen | |
# | |
# Author: Christopher J. Madsen <[email protected]> | |
# Created: 11 Mar 2010 | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the same terms as Perl itself. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the | |
# GNU General Public License or the Artistic License for more details. | |
# | |
# ABSTRACT: Build requirements | |
#--------------------------------------------------------------------- | |
our $VERSION = '0.03'; | |
# This file is part of {{$dist}} {{$dist_version}} ({{$date}}) | |
use Moose; | |
use Moose::Autobox; | |
with 'Dist::Zilla::Role::BeforeBuild'; | |
has _prereq => ( | |
is => 'ro', | |
isa => 'HashRef', | |
default => sub { {} }, | |
); | |
sub BUILDARGS { | |
my ($class, @arg) = @_; | |
my %copy = ref $arg[0] ? %{$arg[0]} : @arg; | |
my $zilla = delete $copy{zilla}; | |
my $name = delete $copy{plugin_name}; | |
return { | |
zilla => $zilla, | |
plugin_name => $name, | |
_prereq => \%copy, | |
} | |
} | |
sub before_build | |
{ | |
my $self = shift; | |
$self->zilla->register_prereqs({ phase => 'build' }, %{ $self->_prereq }); | |
} # end before_build | |
#--------------------------------------------------------------------- | |
no Moose; | |
__PACKAGE__->meta->make_immutable; | |
1; |
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
#--------------------------------------------------------------------- | |
package Dist::Zilla::Plugin::ConfigReq; | |
# | |
# Copyright 2010 Christopher J. Madsen | |
# | |
# Author: Christopher J. Madsen <[email protected]> | |
# Created: 11 Mar 2010 | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the same terms as Perl itself. | |
# | |
# This program is distributed in the hope that it will be useful, | |
# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the | |
# GNU General Public License or the Artistic License for more details. | |
# | |
# ABSTRACT: Config requirements | |
#--------------------------------------------------------------------- | |
our $VERSION = '0.03'; | |
# This file is part of {{$dist}} {{$dist_version}} ({{$date}}) | |
use Moose; | |
use Moose::Autobox; | |
with 'Dist::Zilla::Role::BeforeBuild'; | |
has _prereq => ( | |
is => 'ro', | |
isa => 'HashRef', | |
default => sub { {} }, | |
); | |
sub BUILDARGS { | |
my ($class, @arg) = @_; | |
my %copy = ref $arg[0] ? %{$arg[0]} : @arg; | |
my $zilla = delete $copy{zilla}; | |
my $name = delete $copy{plugin_name}; | |
return { | |
zilla => $zilla, | |
plugin_name => $name, | |
_prereq => \%copy, | |
} | |
} | |
sub before_build | |
{ | |
my $self = shift; | |
$self->zilla->register_prereqs({ phase => 'configure' }, %{ $self->_prereq }); | |
} # end before_build | |
#--------------------------------------------------------------------- | |
no Moose; | |
__PACKAGE__->meta->make_immutable; | |
1; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment