Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add merged_requirements method

  • Loading branch information...
commit c62431540e39cd188c3cca0e0e7344382d5a07c1 1 parent e7483db
@miyagawa authored
Showing with 16 additions and 0 deletions.
  1. +5 −0 lib/Module/CPANfile.pm
  2. +11 −0 lib/Module/CPANfile/Prereqs.pm
View
5 lib/Module/CPANfile.pm
@@ -68,6 +68,11 @@ sub prereqs {
$self->{_prereqs}->as_cpan_meta;
}
+sub merged_requirements {
+ my $self = shift;
+ $self->{_prereqs}->merged_requirements;
+}
+
sub effective_prereqs {
my($self, $features) = @_;
$self->prereqs_with(@{$features || []});
View
11 lib/Module/CPANfile/Prereqs.pm
@@ -74,6 +74,17 @@ sub prereq_each {
}
}
+sub merged_requirements {
+ my $self = shift;
+
+ my $reqs = CPAN::Meta::Requirements->new;
+ for my $prereq (@{$self->{prereqs}}) {
+ $reqs->add_string_requirement($prereq->module, $prereq->requirement->version);
+ }
+
+ $reqs;
+}
+
sub find {
my($self, $module) = @_;
Please sign in to comment.
Something went wrong with that request. Please try again.