Blame README

Packit 90fbfc
NAME
Packit 90fbfc
    CPAN::Changes - Read and write Changes files
Packit 90fbfc
Packit 90fbfc
SYNOPSIS
Packit 90fbfc
        # Load from file
Packit 90fbfc
        my $changes = CPAN::Changes->load( 'Changes' );
Packit 90fbfc
Packit 90fbfc
        # Create a new Changes file
Packit 90fbfc
        $changes = CPAN::Changes->new(
Packit 90fbfc
            preamble => 'Revision history for perl module Foo::Bar'
Packit 90fbfc
        );
Packit 90fbfc
    
Packit 90fbfc
        $changes->add_release( {
Packit 90fbfc
            version => '0.01',
Packit 90fbfc
            date    => '2009-07-06',
Packit 90fbfc
        } );
Packit 90fbfc
Packit 90fbfc
        $changes->serialize;
Packit 90fbfc
Packit 90fbfc
DESCRIPTION
Packit 90fbfc
    It is standard practice to include a Changes file in your distribution.
Packit 90fbfc
    The purpose the Changes file is to help a user figure out what has
Packit 90fbfc
    changed since the last release.
Packit 90fbfc
Packit 90fbfc
    People have devised many ways to write the Changes file. A preliminary
Packit 90fbfc
    specification has been created (CPAN::Changes::Spec) to encourage module
Packit 90fbfc
    authors to write clear and concise Changes.
Packit 90fbfc
Packit 90fbfc
    This module will help users programmatically read and write Changes
Packit 90fbfc
    files that conform to the specification.
Packit 90fbfc
Packit 90fbfc
METHODS
Packit 90fbfc
  new( %args )
Packit 90fbfc
    Creates a new object using %args as the initial data.
Packit 90fbfc
Packit 90fbfc
    "next_token"
Packit 90fbfc
        Used to passes a regular expression for a "next version" placeholder
Packit 90fbfc
        token. See "DEALING WITH "NEXT VERSION" PLACEHOLDERS" for an example
Packit 90fbfc
        of its usage.
Packit 90fbfc
Packit 90fbfc
  load( $filename, %args )
Packit 90fbfc
    Parses $filename as per CPAN::Changes::Spec. If present, the optional
Packit 90fbfc
    %args are passed to the underlaying call to "new()".
Packit 90fbfc
Packit 90fbfc
  load_string( $string, %args )
Packit 90fbfc
    Parses $string as per CPAN::Changes::Spec. If present, the optional
Packit 90fbfc
    %args are passed to the underlaying call to "new()".
Packit 90fbfc
Packit 90fbfc
  preamble( [ $preamble ] )
Packit 90fbfc
    Gets/sets the preamble section.
Packit 90fbfc
Packit 90fbfc
  releases( [ @releases ] )
Packit 90fbfc
    Without any arguments, a list of current release objects is returned
Packit 90fbfc
    sorted by ascending release date. When arguments are specified, all
Packit 90fbfc
    existing releases are removed and replaced with the supplied
Packit 90fbfc
    information. Each release may be either a regular hashref, or a
Packit 90fbfc
    CPAN::Changes::Release object.
Packit 90fbfc
Packit 90fbfc
        # Hashref argument
Packit 90fbfc
        $changes->releases( { version => '0.01', date => '2009-07-06' } );
Packit 90fbfc
    
Packit 90fbfc
        # Release object argument
Packit 90fbfc
        my $rel = CPAN::Changes::Release->new(
Packit 90fbfc
            version => '0.01', date => '2009-07-06'
Packit 90fbfc
        );
Packit 90fbfc
        $changes->releases( $rel );
Packit 90fbfc
Packit 90fbfc
  add_release( @releases )
Packit 90fbfc
    Adds the release to the changes file. If a release at the same version
Packit 90fbfc
    exists, it will be overwritten with the supplied data.
Packit 90fbfc
Packit 90fbfc
  delete_release( @versions )
Packit 90fbfc
    Deletes all of the releases specified by the versions supplied to the
Packit 90fbfc
    method.
Packit 90fbfc
Packit 90fbfc
  release( $version )
Packit 90fbfc
    Returns the release object for the specified version. Should there be no
Packit 90fbfc
    matching release object, undef is returned.
Packit 90fbfc
Packit 90fbfc
  serialize( reverse => $boolean, group_sort => \&sorting_function )
Packit 90fbfc
    Returns all of the data as a string, suitable for saving as a Changes
Packit 90fbfc
    file.
Packit 90fbfc
Packit 90fbfc
    If *reverse* is provided and true, the releases are printed in the
Packit 90fbfc
    reverse order (oldest to latest).
Packit 90fbfc
Packit 90fbfc
    If *group_sort* is provided, change groups are sorted according to the
Packit 90fbfc
    given function. If not, groups are sorted alphabetically.
Packit 90fbfc
Packit 90fbfc
  delete_empty_groups( )
Packit 90fbfc
    Deletes change groups without changes in all releases.
Packit 90fbfc
Packit 90fbfc
DEALING WITH "NEXT VERSION" PLACEHOLDERS
Packit 90fbfc
    In the working copy of a distribution, it's not uncommon to have a "next
Packit 90fbfc
    release" placeholder section as the first entry of the "Changes" file.
Packit 90fbfc
Packit 90fbfc
    For example, the "Changes" file of a distribution using Dist::Zilla and
Packit 90fbfc
    Dist::Zilla::Plugin::NextRelease would look like:
Packit 90fbfc
Packit 90fbfc
        Revision history for Foo-Bar
Packit 90fbfc
Packit 90fbfc
        {{$NEXT}}
Packit 90fbfc
            - Add the 'frobuscate' method.
Packit 90fbfc
Packit 90fbfc
        1.0.0     2010-11-30
Packit 90fbfc
            - Convert all comments to Esperanto.
Packit 90fbfc
Packit 90fbfc
        0.0.1     2010-09-29
Packit 90fbfc
            - Original version unleashed on an unsuspecting world
Packit 90fbfc
Packit 90fbfc
    To have "CPAN::Changes" recognizes the "{{$NEXT}}" token as a valid
Packit 90fbfc
    version, you can use the "next_token" argument with any of the class'
Packit 90fbfc
    constructors. Note that the resulting release object will also be
Packit 90fbfc
    considered the latest release, regardless of its timestamp.
Packit 90fbfc
Packit 90fbfc
    To continue with our example:
Packit 90fbfc
Packit 90fbfc
        # recognizes {{$NEXT}} as a version
Packit 90fbfc
        my $changes = CPAN::Changes->load( 
Packit 90fbfc
            'Changes',
Packit 90fbfc
            next_token => qr/{{\$NEXT}}/,
Packit 90fbfc
        );
Packit 90fbfc
Packit 90fbfc
        my @releases = $changes->releases;
Packit 90fbfc
        print $releases[-1]->version;       # prints '{{$NEXT}}'
Packit 90fbfc
Packit 90fbfc
SEE ALSO
Packit 90fbfc
    *   CPAN::Changes::Spec
Packit 90fbfc
Packit 90fbfc
    *   Test::CPAN::Changes
Packit 90fbfc
Packit 90fbfc
  SIMILAR MODULES
Packit 90fbfc
    *   Module::Metadata::Changes
Packit 90fbfc
Packit 90fbfc
    *   Module::Changes
Packit 90fbfc
Packit 90fbfc
AUTHOR
Packit 90fbfc
    Brian Cassidy <bricas@cpan.org>
Packit 90fbfc
Packit 90fbfc
COPYRIGHT AND LICENSE
Packit 90fbfc
    Copyright 2011-2013 by Brian Cassidy
Packit 90fbfc
Packit 90fbfc
    This library is free software; you can redistribute it and/or modify it
Packit 90fbfc
    under the same terms as Perl itself.
Packit 90fbfc