The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CPAN::Changes::Group::Dependencies::Stats - Create a Dependencies::Stats section detailing summarized differences

VERSION

version 0.001000

SYNOPSIS

  use CPAN::Changes::Release;
  use CPAN::Changes::Group::Dependencies::Stats;

  my $s = CPAN::Changes::Group::Dependencies::Stats->new(
    new_prereqs => CPAN::Meta->load_file('Dist-Foo-1.01/META.json')->effective_prereqs
    old_prereqs => CPAN::Meta->load_file('Dist-Foo-1.00/META.json')->effective_prereqs
  );

  # Currently slightly complicated due to groups themselves
  # not presently being pluggable.
  my $rel = CPAN::Changes::Release->new( version => '1.01' );
  if (@{ my $changes = $s->changes }) {
    $rel->add_group( 'Dependencies::Stats' );
    $rel->add_changes(
      { group => 'Dependencies::Stats' },
      'Change statistics since 1.00',
      @{$changes}
    );
  }
  $rel->serialize();

  # RESULT
  #
  # [Dependencies::Stats]
  # - Change statistics since 1.00
  # - build: -1 (recommends: -1)
  # - configure: +1 -1 (recommends: +1 -1)
  # - develop: +5 -5 (suggests: +2 -1)
  # - test: (recommends: +1 ↑1)

METHODS

changes

Returns a list of change entries.

  my $changes = $object->changes;
  say $_ for @{$changes};

Format:

  %phase: %requiredstats (%optlabel: %optstats, ...)

%phase is one of configure, build, runtime, develop, test

%optlabel is one of recommends, suggests

%requiredstats and %optstats are strings of stat changes:

  %symbol%number %symbol%number ...

%symbol is:

  +   a dependency previously unseen in this phase/rel was added.
  ↑   a dependency in this phase/rel had its version requirement increased.
  ↓   a dependency in this phase/rel had its version requirement decreased.
  -   this phase/rel had a dependency removed
  ~   a dependency type where either side was a complex version requirement changed in some way.

For instance, this diff would display as:

  [Dependencies::Stats]
  - configure: +2
  - develop: +12 ↑3 -2 (suggests: +58)
  - runtime: +3
  - test: +1 ↓1 -1 (recommends: +2)

Which is far less scary ☺

AUTHOR

Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2014 by Kent Fredric <kentfredric@gmail.com>.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.