| 1 | # | ||
| 2 | # This file is part of App-CPAN2Pkg | ||
| 3 | # | ||
| 4 | # This software is copyright (c) 2009 by Jerome Quelin. | ||
| 5 | # | ||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||
| 8 | # | ||
| 9 | use 5.010; | ||
| 10 | use strict; | ||
| 11 | use warnings; | ||
| 12 | |||
| 13 | package App::CPAN2Pkg::Module; | ||
| 14 | # ABSTRACT: poe session to drive a module packaging | ||
| 15 | $App::CPAN2Pkg::Module::VERSION = '3.004'; | ||
| 16 | use Moose; | ||
| 17 | use MooseX::Has::Sugar; | ||
| 18 | use MooseX::SemiAffordanceAccessor; | ||
| 19 | |||
| 20 | use App::CPAN2Pkg::Repository; | ||
| 21 | use App::CPAN2Pkg::Types; | ||
| 22 | |||
| 23 | |||
| 24 | # -- public attributes | ||
| 25 | |||
| 26 | |||
| 27 | has name => ( ro, required, isa=>'Str' ); | ||
| 28 | has local => ( ro, isa=>"App::CPAN2Pkg::Repository", default=>sub{ App::CPAN2Pkg::Repository->new } ); | ||
| 29 | has upstream => ( ro, isa=>"App::CPAN2Pkg::Repository", default=>sub{ App::CPAN2Pkg::Repository->new } ); | ||
| 30 | |||
| 31 | has prereqs => ( | ||
| 32 | ro, auto_deref, | ||
| 33 | isa => 'ArrayRef[Str]', | ||
| 34 | traits => ['Array'], | ||
| 35 | default => sub { [] }, | ||
| 36 | handles => { | ||
| 37 | _add_prereq => 'push', | ||
| 38 | }, | ||
| 39 | ); | ||
| 40 | |||
| 41 | # -- public methods | ||
| 42 | |||
| 43 | |||
| 44 | sub add_prereq { | ||
| 45 | my ($self, $p) = @_; | ||
| 46 | $self->_add_prereq($p); | ||
| 47 | $self->local->add_prereq($p); | ||
| 48 | $self->upstream->add_prereq($p); | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 52 | 1; | ||
| 53 | |||
| 54 | __END__ |