| 1 | package Mail::Decency::Core::Meta::Maintenance; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use Moose::Role; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 3 | ▶ | use version 0.74; our $VERSION = qv( "v0.1.4" ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | ▶ | use Mail::Decency::Helper::IntervalParse qw/ interval_to_int /; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | =head1 NAME | ||||||||||
| 10 | |||||||||||
| 11 | Mail::Decency::Core::Meta::Maintenance | ||||||||||
| 12 | |||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||
| 14 | |||||||||||
| 15 | Role for modules with maintenance capabilities | ||||||||||
| 16 | |||||||||||
| 17 | =head1 CLASS ATTRIBUTES | ||||||||||
| 18 | |||||||||||
| 19 | =head2 maintenance_ttl : Int | ||||||||||
| 20 | |||||||||||
| 21 | Time to live database entry before being wiped via maintenance (depending on the module). | ||||||||||
| 22 | |||||||||||
| 23 | =cut | ||||||||||
| 24 | |||||||||||
| 25 | 3 | has maintenance_ttl => ( is => 'rw', isa => 'Int', default => interval_to_int( '1d' ) ); | |||||||||
| 26 | |||||||||||
| 27 | =head1 MODIFICATIONS | ||||||||||
| 28 | |||||||||||
| 29 | =head2 after init | ||||||||||
| 30 | |||||||||||
| 31 | Read maintenance_ttl from config | ||||||||||
| 32 | |||||||||||
| 33 | =cut | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | after init => sub { | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 36 | 0 | my ( $self ) = @_; | |||||||||
| 37 | $self->maintenance_ttl( interval_to_int( $self->config->{ maintenance_ttl } ) ) | ||||||||||
| 38 | 0 | ▶ | if defined $self->config->{ maintenance_ttl }; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 39 | 3 | }; | |||||||||
| 40 | |||||||||||
| 41 | =head1 REQUIRE METHODS | ||||||||||
| 42 | |||||||||||
| 43 | =head2 maintenance | ||||||||||
| 44 | |||||||||||
| 45 | =cut | ||||||||||
| 46 | |||||||||||
| 47 | 3 | requires 'maintenance'; | |||||||||
| 48 | |||||||||||
| 49 | =head1 AUTHOR | ||||||||||
| 50 | |||||||||||
| 51 | Ulrich Kautz <uk@fortrabbit.de> | ||||||||||
| 52 | |||||||||||
| 53 | =head1 COPYRIGHT | ||||||||||
| 54 | |||||||||||
| 55 | Copyright (c) 2010 the L</AUTHOR> as listed above | ||||||||||
| 56 | |||||||||||
| 57 | =head1 LICENCSE | ||||||||||
| 58 | |||||||||||
| 59 | This library is free software and may be distributed under the same terms as perl itself. | ||||||||||
| 60 | |||||||||||
| 61 | =cut | ||||||||||
| 62 | |||||||||||
| 63 | |||||||||||
| 64 | 3 | 1; | |||||||||