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

NAME

Dist::Zilla::Plugin::AutoVersion::Relative - Time-Relative versioning

VERSION

version 1.001001

SYNOPSIS

Like all things, time is relative. This plugin is to allow you to auto-increment versions based on a relative time point.

It doesn't do it all for you, you can choose, its mostly like The AutoVersion Plugin except there's a few more user-visible entities, and a few more visible options.

CONFIGURATION

To configure this, you specify the date that the version is to be relative to.

Serving Suggestion

  [AutoVersion::Relative]
  major = 1
  minor = 1
  year  = 2009 ;  when we did our last major rev
  month = 08   ;   "           "
  day   = 23   ;   "           "
  hour  = 05   ;   "           "
  minute = 30  ;   "           "
  second = 00  ;  If you're that picky.

  time_zone = Pacific/Auckland  ;  You really want to set this.

   ; 1.0110012
  format = {{$major}}.{{sprintf('%02d%04d%02d', $minor, days, hours }}

For the list of tuneables and how to use them, see "ATTRIBUTES" and "DATE ATTRIBUTES"

FORMATTING

There are a handful of things we inject into the template for you

  # Just to give you an idea, you don't really want to be using this though.
  {{ $major }}.{{ $minor }}{{ days }}{{ hours }}{{ $relative->seconds }}

See "FORMAT FIELDS" for the available fields and their use.

WARNING

If you don't specify Y/M/D, it will default to Jan 01, 2000 , because I couldn't think of a more sane default. But you're setting that anyway, because if you don't,you be cargo cultin' the bad way

ATTRIBUTES

major

major = 1

minor

minor = 1

format

format = {{ sprintf('%d.%02d%04d%02d', $major, $minor, days, hours) }}

See "FORMATING"

DATE ATTRIBUTES

year

year = 2000

month

month = 1

day

day = 1

minute

minute = 0

second

second = 0

time_zone

You want this.

Formatting is like, "Pacific/Auckland" , or merely "+1200" format.

FORMAT FIELDS

$major

The value set for major

$minor

The value set for minor

$relative

A DateTime::Duration object

cldr

cldr($ARG)

CLDR for the current time. See "format_cldr" in DateTime

days

See "days_accurate"

Used to use the algorithm as used in "days_square" but uses the algorithm in "days_accurate" since 0.03000000

days_square

An approximation of the number of days passed since milestone.

Note that for this approximation, it is assumed all months are 31 days long, and years as such, have 372 days.

This is a legacy way of computing dates, superseded by days_accurate since 0.03000000

days_accurate

The number of days passed since the milestone.

hours

The remainder number of hours elapsed.

METHODS

provide_version

returns the formatted version string to satisfy the roles.

ATTRIBUTE METHODS

has_time_zone <- predicate('time_zone')

PRIVATE ATTRIBUTES

_release_time

_release_time DateTime[ro]

_current_time

_current_time DateTime[ro]

relative

relative Duration[ro]

PRIVATE BUILDERS

_build__release_time

_build__current_time

_build_relative

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.