Dist-Zilla-Role-FileWatcher

 view release on metacpan or  search on metacpan

lib/Dist/Zilla/Role/FileWatcher.pm  view on Meta::CPAN

=head2 C<watch_file($file, $subref)>

This method takes two arguments: the C<$file> object to watch, and a
subroutine which is invoked when the file's contents change. It is called as a
method on your plugin, and is passed one additional argument: the C<$file>
object that changed.

=head2 C<lock_file($file, $message?)>

This method takes the C<$file> object to watch, and an optional message
string; when the file is modified after it is locked, the build dies.

=head1 SUPPORT

=for stopwords irc

Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=Dist-Zilla-Role-FileWatcher>
(or L<bug-Dist-Zilla-Role-FileWatcher@rt.cpan.org|mailto:bug-Dist-Zilla-Role-FileWatcher@rt.cpan.org>).
I am also usually active on irc, as 'ether' at C<irc.perl.org>.

=head1 SEE ALSO

t/05-plugin-lock.t  view on Meta::CPAN

            },
        },
    );

    $tzil->chrome->logger->set_debug(1);
    like(
        exception { $tzil->build },
        ( $message
            ? qr{KEEP OUT!}
            : qr{someone tried to munge lib/Foo.pm after we read from it. You need to adjust the load order of your plugins!} ),
        ( $message ? 'custom' : 'default' ) . ' message: detected attempt to change the file after it was locked',
    );

    diag 'got log messages: ', explain $tzil->log_messages
        if not Test::Builder->new->is_passing;
}

done_testing;



( run in 0.330 second using v1.01-cache-2.11-cpan-49f99fa48dc )