NAME
File::Tudo - Tudo TODO file interface
SYNOPSIS
use File::Tudo qw(tudo);
# Simple convenience wrapper, useful for quick scripts
tudo("Fix that one issue");
# OO interface
my $tudo = File::Tudo.new('/path/to/TODO');
$tudo->todo([ 'New TODO list' ]);
$tudo->write;
DESCRIPTION
File::Tudo is a Perl module for reading/writing simple TODO files. It is a port of a Raku (Perl 6) module of the same name.
Subroutines
The following subroutines can be imported.
tudo($str, [ $path ])
tudo()
is a simple convenience wrapper for File::Tudo that appends an additional entry to the end of your TODO file. This can make it useful for reporting TODOs from your Perl scripts.
my @updates = get_package_updates(@pkgs);
tudo("There are updates that need taken care of!") if @updates;
$str
is the string you would like to add as an entry to your TODO file.
$path
is an optional argument that lets you specify the path to your TODO file. If $path
is not given, defaults to the return value of default_todo()
.
default_todo()
default_todo()
returns the default path for your TODO file. It will either be the path specified by the TODO_FILE
environment variable if set, or ~/TODO
otherwise.
Object-Oriented Interface
Methods
new([ $path, [ $params ] ])
Returns a blessed File::Tudo object.
$path
is the path to the TODO file. If not specified, defaults to the return value of default_todo()
.
$params
is a hash ref of various parameters.
- read
-
Boolean determining whether
new()
will initialize itstodo
array from the TODO entries found in the$path
, or ignore them and initializetodo
with an empty array.Defaults to true.
path([ $path ])
Setter/getter method for the object's path attribute. The path will be the path that write()
will write to by default. Is intially set by the $path
supplied in new()
.
todo([ $todo ])
Setter/getter method for the object's todo
attribute. todo
is an array ref of TODOs.
read($path)
Reads a list of TODOs from $path
, overwriting the current array in todo
.
write([ $path ])
Write list of TODOs in todo
to $path
, if specified, or the path in the path
attribute otherwise.
ENVIRONMENT
- TODO_FILE
-
Default path to TODO file.
AUTHOR
Written by Samuel Young, <samyoung12788@gmail.com>.
BUGS
Don't be ridiculous...
Report bugs on my Codeberg, https://codeberg.org/1-1sam.
COPYRIGHT
Copyright 2025, Samuel Young
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0.