File Coverage

blib/lib/App/Toodledo/Goal.pm
Criterion Covered Total %
statement 23 23 100.0
branch n/a
condition n/a
subroutine 9 9 100.0
pod n/a
total 32 32 100.0


line stmt bran cond sub pod time code
1             package App::Toodledo::Goal;
2 2     2   2907 use strict;
  2         4  
  2         56  
3 2     2   9 use warnings;
  2         4  
  2         81  
4              
5             our $VERSION = '1.00';
6              
7 2     2   9 use Carp;
  2         4  
  2         111  
8 2     2   10 use Moose;
  2         4  
  2         12  
9 2     2   11233 use MooseX::Method::Signatures;
  2         5  
  2         14  
10 2     2   905 use App::Toodledo::GoalInternal;
  2         6  
  2         75  
11              
12 2     2   15 use Moose::Util::TypeConstraints;
  2         3  
  2         16  
13 2     2   3836 BEGIN { class_type 'App::Toodledo' };
14              
15             extends 'App::Toodledo::InternalWrapper';
16              
17             has object => ( is => 'ro', isa => 'App::Toodledo::GoalInternal',
18             default => sub { App::Toodledo::GoalInternal->new },
19             handles => sub { __PACKAGE__->internal_attributes( $_[1] ) } );
20              
21              
22 2     2   82092 method add ( App::Toodledo $todo! ) {
23             my @args = ( name => $self->name );
24             $self->$_ and push @args, ( $_ => $self->$_ ) for qw(contributes level);
25             my $added_ref = $todo->call_func( goal => add => { @args } );
26             $added_ref->[0]{id};
27             }
28              
29              
30             1;
31              
32             __END__
33              
34             =head1 NAME
35              
36             App::Toodledo::Goal - class encapsulating a Toodledo goal
37              
38             =head1 SYNOPSIS
39              
40             $goal = App::Toodledo::Goal->new;
41             $goal->name( 'Become president' )
42             $todo = App::Toodledo->new;
43             $todo->add_goal( $goal );
44              
45             =head1 DESCRIPTION
46              
47             This class provides accessors for the properties of a Toodledo goal.
48             The attributes of a goal are defined in the L<App::Toodledo::GoalRole>
49             module.
50              
51             =head1 AUTHOR
52              
53             Peter J. Scott, C<< <cpan at psdt.com> >>
54              
55             =head1 SEE ALSO
56              
57             Toodledo: L<http://www.toodledo.com/>.
58              
59             Toodledo API documentation: L<http://www.toodledo.com/info/api_doc.php>.
60              
61             =head1 COPYRIGHT & LICENSE
62              
63             Copyright 2009-2011 Peter J. Scott, all rights reserved.
64              
65             This program is free software; you can redistribute it and/or modify it
66             under the same terms as Perl itself.
67              
68             =cut