Kent Fredric │‫3﹪🔋

NAME

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

VERSION

version 0.002004

SYNOPSIS

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

  my $s = CPAN::Changes::Group::Dependencies::Stats->new(
    prelude     => [ 'Change statistics since 1.00' ],
    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' );
  $rel->attach( $s ) if $s->has_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

has_changes

Returns whether this group has any interesting changes or not.

  if ( $group->has_changes ) {
    $release->attach_group( $group );
  } else {
    $release->delete_group( $group->name );
  }

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 <kentnl@cpan.org>

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.