| 1 | package Taskwarrior::Kusarigama::Hook::OnModify; | ||
| 2 | 5 | our $AUTHORITY = 'cpan:YANICK'; | |
| 3 | #ABSTRACT: Role for plugins running during the task modification stage | ||
| 4 | 5 | $Taskwarrior::Kusarigama::Hook::OnModify::VERSION = '0.11.0'; | |
| 5 | 5 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 5 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 5 | ▶ | use Moo::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 5 | requires 'on_modify'; | |
| 11 | |||
| 12 | 5 | 1; | |
| 13 | |||
| 14 | __END__ | ||
| 15 | |||
| 16 | =pod | ||
| 17 | |||
| 18 | =encoding UTF-8 | ||
| 19 | |||
| 20 | =head1 NAME | ||
| 21 | |||
| 22 | Taskwarrior::Kusarigama::Hook::OnModify - Role for plugins running during the task modification stage | ||
| 23 | |||
| 24 | =head1 VERSION | ||
| 25 | |||
| 26 | version 0.11.0 | ||
| 27 | |||
| 28 | =head1 SYNOPSIS | ||
| 29 | |||
| 30 | package Taskwarrior::Kusarigama::Plugin::Foo; | ||
| 31 | |||
| 32 | use Moo; | ||
| 33 | |||
| 34 | extends 'Taskwarrior::Kusarigama::Hook'; | ||
| 35 | |||
| 36 | with 'Taskwarrior::Kusarigama::Hook::OnModify'; | ||
| 37 | |||
| 38 | sub on_modify { | ||
| 39 | say "modifying tasks"; | ||
| 40 | } | ||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | =head1 DESCRIPTION | ||
| 45 | |||
| 46 | Role consumed by plugins running during the task modification stage of | ||
| 47 | the Taskwarrior hook lifecycle. | ||
| 48 | |||
| 49 | Requires that a C<on_modify> is implemented. | ||
| 50 | |||
| 51 | The C<on_modify> method, when invoked, will be | ||
| 52 | given the new version of the task, the previous version, | ||
| 53 | and the delta as calculated by | ||
| 54 | L<Hash::Diff>'s c<diff> function. | ||
| 55 | |||
| 56 | sub on_modify { | ||
| 57 | my( $self, $new_task, $old_task, $diff ) = @_; | ||
| 58 | |||
| 59 | ... | ||
| 60 | } | ||
| 61 | |||
| 62 | =head1 AUTHOR | ||
| 63 | |||
| 64 | Yanick Champoux <yanick@cpan.org> | ||
| 65 | |||
| 66 | =head1 COPYRIGHT AND LICENSE | ||
| 67 | |||
| 68 | This software is copyright (c) 2018, 2017 by Yanick Champoux. | ||
| 69 | |||
| 70 | This is free software; you can redistribute it and/or modify it under | ||
| 71 | the same terms as the Perl 5 programming language system itself. | ||
| 72 | |||
| 73 | =cut | ||