App::WRT::EntryStore - model the contents of a wrt repo's entry_dir
use App::WRT::EntryStore; my $entries = App::WRT::EntryStore->new('./archives'); my @all = $entries->all(); my @months = $entries->all_months(); my @years = $entries->all_years(); my @days = $entries->all_days(); # all_* are wrappers for dates_by_depth(): my @days = $entries->dates_by_depth( 3 # 1 for years, 2 for months, 3 for days ); my @recent_days = $entries->recent_days(30); my @recent_months = $entries->recent_months(12); my @recent_years = $entries->recent_years(10); # recent_* are wrappers for recent_by_depth(): my @recent_days $entries->recent_by_depth( 3, # 1 for years, 2 for months, 3 for days 30 # count );
Get a new EntryStore, using a given $entry_dir.
Finds a list of entries for the given directory, and builds data structures which can be used to index into entries by depth, property, and next/previous entry.
Returns a list of all source files for the current entry archive (excepting index files, which are a special case - this part could use some work).
This was originally in App::WRT::Renderer, so there may be some pitfalls here.
Returns a sorted list of all date-like entries which are at a specified depth. Use 1 for years, 2 for months, and 3 for days.
Fairly silly, but entertaining in its perverse way. all_years(), all_months(), and all_days() are provided for convenience.
Convenience wrappers for dates_by_depth().
Convenience wrappers for extracting days or months in a given month or year.
Returns the $entry_count most recent dated entries at $depth (1 for year, 2 for month, 3 for day). recent_years(), recent_months(), and recent_days() are provided for convenience.
Convenience wrappers for recent_by_depth().
Store hashes which map dated entries to their previous and next entries at the same depth in the tree. That is, something like:
%prev_dates = { '2014' => '2013', '2014/1' => '2013/12' '2014/1/1' => '2013/12/30', ... } %next_dates = { '2013' => '2014', '2013/12' => '2014/1', '2013/12/30' => '2014/1/1', ... }
Return an entry's parent, or undef if it's at the top level.
Return an entry's (immediate) children.
Return the previous entry at the same depth for the given entry.
Return the next entry at the same depth for the given entry.
Return an array of any entries for the given property.
Return an array of any properties for the given entry.
Return 1 if the given entry has the given property.
Return an array of all properties.
Check if a given entry exists.
Check if an entry is a directory.
Check if an entry is a flatfile.
Check if an entry contains an index file.
TODO: Should this care about the pathological(?) case where index is a directory?
Get a base name (i.e., filename without path) for a given entry.
To install App::WRT, copy and paste the appropriate command in to your terminal.
cpanm
cpanm App::WRT
CPAN shell
perl -MCPAN -e shell install App::WRT
For more information on module installation, please visit the detailed CPAN module installation guide.