The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

App::Toodledo::Task - class encapsulating a Toodledo task

SYNOPSIS

  $task = App::Toodledo::Task->new;
  $task->title( 'Put the cat out' );

DESCRIPTION

This class provides accessors for the properties of a Toodledo task. The attributes of a task are defined in the App::Toodledo::TaskRole module.

METHODS

@tags = $task->tags( [@tags] )

Return the tags of the task as a list (splits the attribute on comma). If a list is provided, set the tags to that list.

$task->has_tag( $tag )

Return true if the tag $tag is in the list returned by tags().

$task->add_tag( $tag )

Add the given tag. No-op if the task already has that tag.

$task->remove_tag( $tag )

Remove the given tag. No-op if the task doesn't have that tag.

$task->edit( @tasks )

This is the method called by:

  App::Toodledo::edit( $task )

You can pass multiple tasks to it:

  $todo->edit( @tasks )

and they will all be updated. The current maximum number of tasks you can send to Toodledo for editing is 50. This method does not check for that. (They might raise the limit in the future.) Bounds checking is the caller's responsibility.

$task->status_str, $task->priority_str

Each of these methods operates on the string defined at http://api.toodledo.com/2/tasks/index.php, not the integer. The string will be turned into the integer going into Toodledo and the integer will get turned into the string coming out. Examples:

  $task->priority_str( 'Top' )
  $task->status_str eq 'Hold' and ...

Each method can be used in a App::Toodledo::select call.

$task->folder_name, $task->context_name, $task->location_name, $task->goal_name

Each of these methods returns and optionally sets the given attribute via its name rather than the indirect ID that is stored in the task. An exception is thrown if no object with that name exists when setting it. Examples:

  $task->folder_name( $todo, 'Later' );
  $task->context_name( $todo ) eq 'Home' and ...

If the value is null, returns the empty string rather than the Toodledo display value of "No <Whatever>".

NOTE: An App::Toodledo object must be passed as the first parameter so it can look up the mapping of objects to names.

CAVEAT

This is a very basic implementation of Toodledo tasks. It is missing much that would be helpful with dealing with repeating tasks. Patches welcome.

AUTHOR

Peter J. Scott, <cpan at psdt.com>

SEE ALSO

Toodledo: http://www.toodledo.com/.

Toodledo API documentation: http://www.toodledo.com/info/api_doc.php.

COPYRIGHT & LICENSE

Copyright 2009-2011 Peter J. Scott, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.