| 1 | package Exobrain::Measurement::Mailbox; | ||
| 2 | |||
| 3 | use 5.010; | ||
| 4 | use autodie; | ||
| 5 | use Moose; | ||
| 6 | use Method::Signatures; | ||
| 7 | |||
| 8 | # ABSTRACT: Mailbox measurement packet | ||
| 9 | our $VERSION = '1.08'; # VERSION | ||
| 10 | |||
| 11 | # Declare that we will have a summary attribute. This is to make | ||
| 12 | # our roles happy. | ||
| 13 | sub summary; | ||
| 14 | |||
| 15 | # This needs to happen at begin time so it can add the 'payload' | ||
| 16 | # keyword. | ||
| 17 | BEGIN { with 'Exobrain::Message'; } | ||
| 18 | |||
| 19 | |||
| 20 | payload server => ( isa => 'Str' ); | ||
| 21 | payload user => ( isa => 'Str' ); | ||
| 22 | payload mailbox => ( isa => 'Str' ); | ||
| 23 | payload count => ( isa => 'Int' ); | ||
| 24 | |||
| 25 | has summary => ( | ||
| 26 | isa => 'Str', builder => '_build_summary', lazy => 1, is => 'ro' | ||
| 27 | ); | ||
| 28 | |||
| 29 | method _build_summary() { | ||
| 30 | return join(" ", | ||
| 31 | $self->user, '@', $self->server, "/", $self->mailbox, | ||
| 32 | "has", $self->count, "messages" | ||
| 33 | ); | ||
| 34 | } | ||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | __END__ |