NAME
    Dist::Zilla::UtilRole::MaybeZilla - Soft-dependency on Dist::Zilla for
    Utilities.

VERSION
    version 0.001000

DESCRIPTION
    "Dist::Zilla" Is Great. Long Live "Dist::Zilla" But when you're writing
    a utility class, loading "Dist::Zilla" may be not necessary, and can
    make testing things harder.

    Namely, because to test anything that requires "Dist::Zilla", requires
    that you have a valid build tree, which may be lots of unnecessary work
    if you only need "dzil" for simple things like error logging.

    Or perhaps, you have other resources that you only conventionally fetch
    from "dzil", such as the "dzil build-root", for the sake of making a
    "Git::Wrapper", but you're quite happy with passing "Git::Wrapper"
    instances directly for testing.

    And I found myself doing quite a lot of the latter, and re-writing the
    same code everywhere to do it.

    So, this role provides a "zilla" attribute that is ONLY required if
    something directly calls "$self->zilla", and it fails on invocation.

    And provides a few utility methods, that will try to use "zilla" where
    possible, but fallback to a somewhat useful default if those are not
    available to you.

        package MyPlugin;
        use Moose;
        with 'Dist::Zilla::UtilRole::MaybeZilla';

        ...

        sub foo {
            if ( $self->has_zilla ) {
                $self->zilla->whatever
            } else {
                $slightlymessyoption
            }
        }

    Additionally, it provides a few compatibility methods to make life
    easier, namely

        log_debug, log, log_fatal

    Which will invoke the right places in "dzil" if possible, but revert to
    a sensible default if not.

ATTRIBUTES
  "zilla"
    A lazy attribute, populated from "plugin" where possible, "die"ing if
    not.

  "plugin"
    A lazy attribute that "die"s if required and not specified.

FOOTNOTES
    I had intended to have logging methods on this, but they proved too
    messy and problematic.

    More, I discovered the way Dist::Zilla handles logs is kinda problematic
    too, because you may have noticed,

        $self->log_fatal()

    May just have a predisposition from reporting the failure context being

        Moose/Method/Deferred.pm

    Most cases. ( ☹ )

    So I'm experimentally toying with using more "Log::Contextual".

    See "[LogContextual]"

AUTHOR
    Kent Fredric <kentfredric@gmail.com>

COPYRIGHT AND LICENSE
    This software is copyright (c) 2013 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.