Directory::Organize - create and find directories organized by date
This documentation refers to Directory::Organize version v1.0.0.
use Directory::Organize; $do = new Directory::Organize($basedir); @directories = $do->get_descriptions(\%constraints); $path = $do->new_dir($description); $do->set_pattern($pattern); $do->set_time_constraint('<',$year,$month,$day); $do->set_today($day,$month,$year);
use Directory::Organize; $do = new Directory::Organize($basedir);
This functions returns an array of arrays of the form
([ path1, description1 ], ... [ pathn, descriptionn ], )
It searches all subdirectories three levels below
$basedir for a file named .project. The returned array contains the relative path from the base directory and the first line of the .project file as description. This array is sorted descending by path.
@directories = $do->get_descriptions();
This function creates a new directory according to the current date or the date given with
set_doday() and creates a file named .project in the newly created directory containing the given description.
If there already exists a directory for the given date, it will add a suffix to the day. Therefore if you call this functions three times with the date 2009-05-25, the first directory created will be 2009/05/25, the second will be 2009/05/25a and the third 2009/05/25b.
The function returns the path of the created directory.
$path = $do->new_dir($description);
This function sets a pattern to constrain the list of subdirectories returned by the next call of get_descriptions().
This function sets a constraint for the time of creation of the project directories returned with get_descriptions();
$do->set_time_constraint($op,$year,$month,$day); $do->set_time_constraint($op,$year,$month); $do->set_time_constraint($op,$year);
$op specifies the operator and may be one of '=', '<' or '>' depending on whether the time constraint should be in, before or after the given time.
$year denotes the year,
$month the month (1..12) and
$day the day (1..31) that the operator should be applied to. If
$month are omitted, the operator applies to the whole month or year.
Specifies the date to be used the next time when creating a new directory with new_dir(). Arguments may be
to set the current date
to set another day in this month and year.
to set another day and month in this year.
to set an arbitrary date.
Copyright (c) 2009-2018 Mathias Weidner (firstname.lastname@example.org). All rights reserved.
This module is free software; you can redistribute and/or modify it under the same terms as Perl itself. See perlartistic.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.