Exobrain/Measurement/Geo.pm untested

filter: Statementstmt 0.0% 0 / 30 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 0.0% 0 / 7 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 56 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BUILD
2.0
BEGIN
2.0
CRAP 2.0
1 package Exobrain::Measurement::Geo;
2 use Moose::Role;
3 use Method::Signatures;
4 use Exobrain::Measurement::Geo::POI;
5 use Exobrain::Types qw(POI);
6  
7 # ABSTRACT: Geo measurement packet for Exobrain
8 our $VERSION = '1.08'; # VERSION
9  
10 # Declare that we will have a summary attribute. This is to make
11 # our roles happy.
12 sub summary;
13  
14 # This needs to happen at begin time so it can add the 'payload'
15 # keyword.
16 BEGIN { with 'Exobrain::Message'; }
17  
18  
19 payload user => ( isa => 'Str' ); # User on that service
20 payload user_name=> ( isa => 'Str', required => 0);
21 payload poi => ( isa => POI, required => 0, coerce => 1 ); # Point of interest
22 payload is_me => ( isa => 'Bool' ); # Is this the current user?
23 payload message => ( isa => 'Str', required => 0); # Any message with checkin
24  
25 has summary => (
26 isa => 'Str', builder => '_build_summary', lazy => 1, is => 'ro'
27 );
28  
29 method _build_summary() {
30  
31 my $fmt_msg = "";
32  
33 if (my $message = $self->message) {
34 $fmt_msg = qq{with message: "$message"};
35 }
36 return join(" ",
37 $self->user_name || $self->user, 'is at', $self->poi->name,
38 $fmt_msg,
39 '( via', $self->source, ')', ($self->is_me ? "[Me]" : ""),
40 );
41 }
42  
43 no warnings qw(redefine);
44  
45 sub BUILD { };
46  
47 after BUILD => method (...) {
48  
49 # Fill our POI source if required
50  
51 if ($self->poi and not $self->poi->source) {
52 $self->poi->source($self->source);
53 }
54  
55 };
56  
57 1;
58  
59 __END__