Skip to content

kentnl/CPAN-Distribution-ReleaseHistory

Repository files navigation

NAME

CPAN::Distribution::ReleaseHistory - Show the release history of a single distribution

VERSION

version 0.002006

SYNOPSIS

This is similar in concept to CPAN::ReleaseHistory, except its tailored to use a single distribution name, and uses MetaCPAN to resolve its information.

use CPAN::Distribution::ReleaseHistory;

my $release_history = CPAN::Distribution::ReleaseHistory->new(
  distribution => 'Dist-Zilla',
  # ua          => a HTTP::Tiny instance to use for requests
  # es          => a Search::Elasticsearch instance
  # scroll_size => 1000  : How many results to fetch per HTTP request
  # sort        => 'desc': Direction of sort ( vs 'asc' and undef )
);

# Returns a CPAN::Distribution::ReleaseHistory::ReleaseIterator
my $iterator = $release_history->release_iterator();

# $release is an instance of CPAN::Distribution::ReleaseHistory::Release
while ( my $release = $iterator->next_release() ) {
  print $release->distname();                   # Dist-Zilla
  print $release->path();                       # R/RJ/RJBS/Dist-Zilla-1.000.tar.gz
  print scalar gmtime $release->timestamp();    # Timestamp is Unixtime.
  print $release->size();                       # 30470 ( bytes )
  my $distinfo = $release->distinfo();          # CPAN::DistInfo object
}

METHODS

release_iterator

Perform the query and return a new CPAN::Distribution::ReleaseHistory::ReleaseIterator to walk over the results.

my $iterator = $object->release_iterator

has_ua

Determine if user specified a custom UserAgent

ATTRIBUTES

distribution

A string exactly matching a name of a CPAN distribution.

example:

Dist-Zilla
MetaCPAN-Client
Search-Elasticsearch
WWW-Mechanize-Cached

sort

The implicit sort direction of the output.

default: 'desc' # The most recent release is returned first.

Alternative options:

'asc' # The oldest release is returned first
undef # Results are unsorted

undef

Opting for undef for this value will give a slight speed up to the responsiveness of queries.

Though this benefit will only be observed in conjunction with low values of scroll_size

   5 desc average 0.08625 /each   11.594 items/sec
  5 undef average 0.03856 /each   25.937 items/sec

  10 desc average 0.05384 /each   18.573 items/sec
 10 undef average 0.03773 /each   26.507 items/sec

  20 desc average 0.03856 /each   25.934 items/sec
 20 undef average 0.02758 /each   36.252 items/sec

  50 desc average 0.02579 /each   38.777 items/sec
 50 undef average 0.02547 /each   39.267 items/sec

 100 desc average 0.02279 /each   43.873 items/sec
100 undef average 0.02510 /each   39.846 items/sec

scroll_size

Volume of results to fetch per request.

default: 1000

Larger values give slower responses but faster total execution time.

Smaller values give faster responses but slower total execution time. ( Due to paying ping time both ways per request in addition to other per-request overheads that are constant sized )

ua

A HTTP::Tiny compatible user agent.

es

A Search::Elasticsearch instance.

AUTHOR

Kent Fredric kentnl@cpan.org

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 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.

About

Show the release history of a single distribution

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages