| 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::Repository; | ||
| 14 | # ABSTRACT: repository details for a given module | ||
| 15 | $App::CPAN2Pkg::Repository::VERSION = '3.004'; | ||
| 16 | use Moose; | ||
| 17 | use MooseX::Has::Sugar; | ||
| 18 | use MooseX::SemiAffordanceAccessor; | ||
| 19 | |||
| 20 | use App::CPAN2Pkg::Types; | ||
| 21 | |||
| 22 | |||
| 23 | # -- public attributes | ||
| 24 | |||
| 25 | |||
| 26 | has status => ( rw, isa=>"Status", default=>"not started" ); | ||
| 27 | has _prereqs => ( | ||
| 28 | ro, | ||
| 29 | traits => ['Hash'], | ||
| 30 | isa => 'HashRef[Str]', | ||
| 31 | default => sub { {} }, | ||
| 32 | handles => { | ||
| 33 | _add_prereq => 'set', | ||
| 34 | prereqs => 'keys', | ||
| 35 | rm_prereq => 'delete', | ||
| 36 | can_build => 'is_empty', | ||
| 37 | miss_prereq => 'exists', | ||
| 38 | }, | ||
| 39 | ); | ||
| 40 | |||
| 41 | |||
| 42 | # -- public methods | ||
| 43 | |||
| 44 | |||
| 45 | # methods above provided for free by moose traits. | ||
| 46 | |||
| 47 | |||
| 48 | sub add_prereq { | ||
| 49 | my ($self, $modname) = @_; | ||
| 50 | $self->_add_prereq( $modname, $modname ); | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | no Moose; | ||
| 55 | __PACKAGE__->meta->make_immutable; | ||
| 56 | 1; | ||
| 57 | |||
| 58 | __END__ |