1PFT::Content(3)       User Contributed Perl Documentation      PFT::Content(3)
2
3
4

NAME

6       PFT::Content - Filesytem tree mapping content
7

SYNOPSIS

9           PFT::Content->new($basedir);
10           PFT::Content->new($basedir, {create => 1});
11

DESCRIPTION

13       The structure is the following:
14
15           content
16           ├── attachments
17           ├── blog
18           ├── pages
19           ├── pics
20           └── tags
21
22   Properties
23       Quick accessors for directories
24
25           $tree->dir_root
26           $tree->dir_blog
27           $tree->dir_pages
28           $tree->dir_tags
29           $tree->dir_pics
30           $tree->dir_attachments
31
32       Non-existing directories are created by the constructor if the "{create
33       => 1}" option is passed as last constructor argument.
34
35   Methods
36       new_entry
37           Create and return a page. A header is required as argument.
38
39           If the page does not exist it gets created according to the header.
40           If the header contains a date, the page is considered to be a blog
41           entry (and positioned as such). If the data is missing the day
42           information, the entry is a month entry.
43
44       entry
45           Similar to "new_entry", but does not create a content file if it
46           doesn't exist already.
47
48       hdr_to_path
49           Given a PFT::Header object, returns the path of a page or blog page
50           within the tree.
51
52           Note: this function does not work properly if you are seeking for a
53           tag. Tags are a different beast, since they have the same header as
54           a page, but they belong to a different place.
55
56       new_tag
57           Create and return a tag page. A header is required as argument. If
58           the tag page does not exist it gets created according to the
59           header.
60
61       tag Similar to "new_tag", but does not create the content file if it
62           doesn't exist already.
63
64       blog_ls
65           List all blog entries (days and months).
66
67       pages_ls
68           List all pages (not tags pages)
69
70       tags_ls
71           List all tag pages (not regular pages)
72
73       entry_ls
74           List all entries (pages + blog + tags)
75
76       pic Get a picture.
77
78           Accepts a list of strings which will be joined into the path of a
79           picture file.  Returns a "PFT::Content::Blob" instance, which could
80           correspond to a non-existing file. The caller might create it (e.g.
81           by copying a picture on the corresponding path).
82
83       pics_ls
84           List all pictures.
85
86       attachment
87           Get an attachment.
88
89           Accepts a list of strings which will be joined into the path of an
90           attachment file.  Returns a "PFT::Content::Blob" instance, which
91           could correspond to a non-existing file. The caller might create it
92           (e.g. by copying a file on the corresponding path).
93
94           Note that the input path should be made by strings in encoded form,
95           in order to match the filesystem path.
96
97       attachments_ls
98           List all attachments.
99
100       blog_back
101           Go back in blog history of a number of days, return the entries
102           corresponding to that date.
103
104           Expects one optional argument as the number of backward days in the
105           blog history. If such argument is not provided, it defaults to 0,
106           returning the entries of the latest edit day.
107
108           Please note that only days containing entries really count. If a
109           blog had one entry today, no entry for yesterday and one the day
110           before yesterday, blog_back(0) will return today's entry, and
111           blog_back(1) will return the entry of two days ago.
112
113           Returns a list PFT::Content::Blog object, possibly empty if the
114           blog does not have that many days.
115
116       blog_at
117           Go back in blog history to a certain date.
118
119           Expects as argument a "PFT::Date" item indicating a date to seek
120           for blog entries.
121
122           Returns a possibly empty list of "PFT::Content::Blog" objects
123           corresponding to the zero, one or more entries in the specified
124           date.
125
126       detect_date
127           Given a "PFT::Content::File" object (or any subclass) determines
128           the corresponding date by analyzing the path. Returns a "PFT::Date"
129           object or undef if the page does not have date.
130
131           This function is helpful for checking inconsistency between the
132           date declared in headers and the date used on the file system.
133
134       detect_slug
135           Given a "PFT::Content::File" object (or any subclass) determines
136           the corresponding slug by analyzing the path. Returns the slug or
137           undef if the content does not have a slug (e.g. months).
138
139           This function is helpful for checking inconsistency between the
140           slug declared in headers and the slug used on the file system.
141
142       was_renamed
143           Notify this content abstraction about the renaming of the
144           corresponding content file.  First parameter is the original name,
145           second parameter is the new name.
146
147
148
149perl v5.36.0                      2022-07-22                   PFT::Content(3)
Impressum