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