1CPANPLUS::Internals::SoUusrecre(C3o)ntributed Perl DocumCePnAtNaPtLiUoSn::Internals::Source(3)
2
3
4
6 CPANPLUS::Internals::Source - internals for updating source files
7
9 ### lazy load author/module trees ###
10
11 $cb->_author_tree;
12 $cb->_module_tree;
13
15 CPANPLUS::Internals::Source controls the updating of source files and
16 the parsing of them into usable module/author trees to be used by
17 "CPANPLUS".
18
19 Functions exist to check if source files are still "good to use" as
20 well as update them, and then parse them.
21
22 The flow looks like this:
23
24 $cb->_author_tree || $cb->_module_tree
25 $cb->_check_trees
26 $cb->__check_uptodate
27 $cb->_update_source
28 $cb->__update_custom_module_sources
29 $cb->__update_custom_module_source
30 $cb->_build_trees
31 ### engine methods
32 { $cb->_init_trees;
33 $cb->_standard_trees_completed
34 $cb->_custom_trees_completed
35 }
36 $cb->__create_author_tree
37 ### engine methods
38 { $cb->_add_author_object }
39 $cb->__create_module_tree
40 $cb->__create_dslip_tree
41 ### engine methods
42 { $cb->_add_module_object }
43 $cb->__create_custom_module_entries
44
45 $cb->_dslip_defs
46
48 $cb->_build_trees( uptodate => BOOL, [use_stored => BOOL, path => $path,
49 verbose => BOOL] )
50 This method rebuilds the author- and module-trees from source.
51
52 It takes the following arguments:
53
54 uptodate
55 Indicates whether any on disk caches are still ok to use.
56
57 path
58 The absolute path to the directory holding the source files.
59
60 verbose
61 A boolean flag indicating whether or not to be verbose.
62
63 use_stored
64 A boolean flag indicating whether or not it is ok to use previously
65 stored trees. Defaults to true.
66
67 Returns a boolean indicating success.
68
69 $cb->_check_trees( [update_source => BOOL, path => PATH, verbose => BOOL] )
70 Retrieve source files and return a boolean indicating whether or not
71 the source files are up to date.
72
73 Takes several arguments:
74
75 update_source
76 A flag to force re-fetching of the source files, even if they are
77 still up to date.
78
79 path
80 The absolute path to the directory holding the source files.
81
82 verbose
83 A boolean flag indicating whether or not to be verbose.
84
85 Will get information from the config file by default.
86
87 $cb->__check_uptodate( file => $file, name => $name, [update_source =>
88 BOOL, verbose => BOOL] )
89 "__check_uptodate" checks if a given source file is still up-to-date
90 and if not, or when "update_source" is true, will re-fetch the source
91 file.
92
93 Takes the following arguments:
94
95 file
96 The source file to check.
97
98 name
99 The internal shortcut name for the source file (used for config
100 lookups).
101
102 update_source
103 Flag to force updating of sourcefiles regardless.
104
105 verbose
106 Boolean to indicate whether to be verbose or not.
107
108 Returns a boolean value indicating whether the current files are up to
109 date or not.
110
111 $cb->_update_source( name => $name, [path => $path, verbose => BOOL] )
112 This method does the actual fetching of source files.
113
114 It takes the following arguments:
115
116 name
117 The internal shortcut name for the source file (used for config
118 lookups).
119
120 path
121 The full path where to write the files.
122
123 verbose
124 Boolean to indicate whether to be verbose or not.
125
126 Returns a boolean to indicate success.
127
128 $cb->__create_author_tree([path => $path, uptodate => BOOL, verbose =>
129 BOOL])
130 This method opens a source files and parses its contents into a
131 searchable author-tree or restores a file-cached version of a previous
132 parse, if the sources are uptodate and the file-cache exists.
133
134 It takes the following arguments:
135
136 uptodate
137 A flag indicating whether the file-cache is uptodate or not.
138
139 path
140 The absolute path to the directory holding the source files.
141
142 verbose
143 A boolean flag indicating whether or not to be verbose.
144
145 Will get information from the config file by default.
146
147 Returns a tree on success, false on failure.
148
149 $cb->_create_mod_tree([path => $path, uptodate => BOOL, verbose => BOOL])
150 This method opens a source files and parses its contents into a
151 searchable module-tree or restores a file-cached version of a previous
152 parse, if the sources are uptodate and the file-cache exists.
153
154 It takes the following arguments:
155
156 uptodate
157 A flag indicating whether the file-cache is up-to-date or not.
158
159 path
160 The absolute path to the directory holding the source files.
161
162 verbose
163 A boolean flag indicating whether or not to be verbose.
164
165 Will get information from the config file by default.
166
167 Returns a tree on success, false on failure.
168
169 $cb->__create_dslip_tree([path => $path, uptodate => BOOL, verbose =>
170 BOOL])
171 This method opens a source files and parses its contents into a
172 searchable dslip-tree or restores a file-cached version of a previous
173 parse, if the sources are uptodate and the file-cache exists.
174
175 It takes the following arguments:
176
177 uptodate
178 A flag indicating whether the file-cache is uptodate or not.
179
180 path
181 The absolute path to the directory holding the source files.
182
183 verbose
184 A boolean flag indicating whether or not to be verbose.
185
186 Will get information from the config file by default.
187
188 Returns a tree on success, false on failure.
189
190 $cb->_dslip_defs ()
191 This function returns the definition structure (ARRAYREF) of the dslip
192 tree.
193
194 $file = $cb->_add_custom_module_source( uri => URI, [verbose => BOOL] );
195 Adds a custom source index and updates it based on the provided URI.
196
197 Returns the full path to the index file on success or false on failure.
198
199 $index = $cb->__custom_module_source_index_file( uri => $uri );
200 Returns the full path to the encoded index file for $uri, as used by
201 all "custom module source" routines.
202
203 $file = $cb->_remove_custom_module_source( uri => URI, [verbose => BOOL] );
204 Removes a custom index file based on the URI provided.
205
206 Returns the full path to the index file on success or false on failure.
207
208 %files = $cb->__list_custom_module_sources
209 This method scans the 'custom-sources' directory in your base directory
210 for additional sources to include in your module tree.
211
212 Returns a list of key value pairs as follows:
213
214 /full/path/to/source/file%3Fencoded => http://decoded/mirror/path
215
216 $bool = $cb->__update_custom_module_sources( [verbose => BOOL] );
217 Attempts to update all the index files to your custom module sources.
218
219 If the index is missing, and it's a "file://" uri, it will generate a
220 new local index for you.
221
222 Return true on success, false on failure.
223
224 $ok = $cb->__update_custom_module_source
225 Attempts to update all the index files to your custom module sources.
226
227 If the index is missing, and it's a "file://" uri, it will generate a
228 new local index for you.
229
230 Return true on success, false on failure.
231
232 $bool = $cb->__write_custom_module_index( path => /path/to/packages, [to =>
233 /path/to/index/file, verbose => BOOL] )
234 Scans the "path" you provided for packages and writes an index with all
235 the available packages to "$path/packages.txt". If you'd like the index
236 to be written to a different file, provide the "to" argument.
237
238 Returns true on success and false on failure.
239
240 $bool = $cb->__create_custom_module_entries( [verbose => BOOL] )
241 Creates entries in the module tree based upon the files as returned by
242 "__list_custom_module_sources".
243
244 Returns true on success, false on failure.
245
246
247
248perl v5.32.0 2020-12-21 CPANPLUS::Internals::Source(3)