4c4ce4d0691299c8d13f955741b46a6f3144ab3f
[feisty_meow.git] / documentation / doc_fodder / perl_tools.html
1 <!DOCTYPE html PUBLIC "-//w3c//dtd html 4.0 transitional//en">
2 <html>
3 <head>
4   <meta http-equiv="Content-Type"
5  content="text/html; charset=iso-8859-1">
6   <meta name="Author" content="Fred T. Hamster">
7   <meta name="generator"
8  content="Mozilla/5.0 (X11; U; Linux i686; en-US) [Mozilla]">
9   <meta name="Description"
10  content="Open Source Perl for Your Perusement">
11   <meta name="KeyWords"
12  content="reusable, open source, perl, shell, script, recursive, diff, snarf, yeti, free, source code, example, filename, snarfer">
13   <title>Feisty Meow Concerns Perl Scripts</title>
14   <meta content="Fred T. Hamster" name="author">
15   <meta
16  content="Scripts for backing up hierarchies, generating documents from other documents, etc etc."
17  name="description">
18 </head>
19 <body
20  style="background-image: url(pics/celtic_destiny14.jpg); background-color: rgb(0, 0, 0); color: rgb(255, 255, 153);"
21  alink="#ffcc00" link="#66ff99" vlink="#00cc00">
22 <h3>&nbsp; </h3>
23 <center>
24 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
25  cols="1" width="92%">
26   <tbody>
27     <tr>
28       <td>
29       <center>
30       <h1><a href="http://feistymeow.org/">Feisty Meow Concerns Codebase</a> Open Source Perl
31 Scripts</h1>
32       <h2>Some Hopefully Useful GPL-Licensed Perl Code<br>
33       </h2>
34       </center>
35       <center>Contributed by Chris Koeritz (<a
36  href="mailto:%20koeritz@gruntose.com">Koeritz@Gruntose.COM</a>) <br>
37 See the <a href="http://www.gruntose.com/Info/GNU/GPL.html">GNU Public
38 License</a> for details of licensing.<span style="font-style: italic;"></span><br>
39       </center>
40       <h4>Caveats:</h4>
41       <ol>
42         <li>No warranty, express, implied or imagined, is offered for
43 these files.&nbsp; If you destroy your life by running one of them, I
44 will have sympathy, but that's about it.</li>
45         <li>Some of these shell scripts depend on environment variables.&nbsp;
46 The most frequent case of this is FEISTY_MEOW_APEX, which should point to the
47 top-level
48 directory where the Feisty Meow scripts are stored on your
49 machine. &nbsp; This variable is set by default when the scripts are in
50 the ~/feisty_meow folder.&nbsp; Consult your operating
51 system documentation if you are
52 unfamiliar with the concept or management of environment variables.</li>
53         <li>These files are provided as possibly useful shell scripts
54 rather than as full-fledged reusable and object oriented components.</li>
55         <li>Improvements and contributions are gladly accepted.&nbsp;
56 They will be processed as fast as our schedule permits.&nbsp; Please
57 send any changes to the Gruntose Curator at <a
58  href="mailto:%20fred@gruntose.com">fred@gruntose.com</a> .</li>
59         <li>These files are mostly portable between Unix and the
60 various Windoze OSes, but in many cases you may want to fix the
61 defaults or path names to make them more suitable for your own needs.</li>
62         <li>Some of the scripts invoke external programs that are
63 available for most Unixes.&nbsp; For Windoze users, a set of GNU Unix
64 utilities is available at "<a href="http://www.mingw.org/">http://www.mingw.org/</a>".</li>
65         <li>An alternative, but not recommended, GNU suite is
66 at "<a href="http://www.cygwin.com/">http://www.cygwin.com/</a>".</li>
67         <li><span style="color: rgb(255, 255, 204);">Direct Cognition</span>:
68 View the scripts directory itself rather than navigating with the links
69 below: <a href=".">scripts</a>.</li>
70       </ol>
71       </td>
72     </tr>
73   </tbody>
74 </table>
75 </center>
76 <h3>&nbsp; </h3>
77 <center>
78 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
79  cols="1" width="92%">
80   <tbody>
81     <tr>
82       <td>
83       <h2>Library Files<br>
84       </h2>
85       <blockquote>
86         <h3><a href="../text/diff_lib.pl">diff_lib.pl</a></h3>
87         <blockquote>The "differ" utilities can be used to compare two
88 directories of text or binary files against each other.&nbsp; The two
89 directories are presumably close in contents.&nbsp; This can be useful
90 when one is revising a set of files and wants to synchronize an older
91 copy against a newer version.&nbsp; Support for "<a href="#differ">differ.pl</a>"
92 is provided
93 here.</blockquote>
94         <h3> <a name="filename helper"></a><a
95  href="../files/filename_helper.pl">filename_helper.pl</a></h3>
96         <blockquote>Contains a handy set of utilities for manipulating
97 filenames.&nbsp; These can help to make perl scripts portable across
98 the two well-known types of filename separators ('/' and '\').&nbsp;
99 They also provide support for ripping up filenames into their
100 components.</blockquote>
101         <h3> <a href="../core/inc_num.pl">inc_num.pl</a></h3>
102         <blockquote>This is a simple utility that manages a file with a
103 number in it.&nbsp; This is somewhat more useful than it sounds.&nbsp;
104 Functions are provided to get the current number and to change the
105 number.</blockquote>
106         <h3> </h3>
107         <h3> <a href="../archival/shared_snarfer.pl">shared_snarfer.pl</a></h3>
108         <blockquote>This library supports the "snarf" utilities.&nbsp;
109 The
110 utilities manipulate archive files with the ".snarf" extension.&nbsp;
111 These
112 packed
113 snarf files are compressed chunks of directory hierarchies.&nbsp; Bob
114 files
115 are useful because they track a number per distinct "snarf" types that
116 is
117 used to make uniquely named new archives of the appropriate type.&nbsp;
118 This
119 number is an ever increasing integer that's stored in a well-known
120 (configurable) location.&nbsp; When a snarf file is unpacked (using the
121 "unsnarf" tool), the number is updated on the local machine so that the
122 next generated file will
123 be one greater than the previous number.&nbsp; If one is travelling
124 between
125 two machines with the same snarf file, this will have the effect of
126 keeping
127 the number updated on both sides.
128         </blockquote>
129         <h3><a href="../files/zap_the_dir.pl">zap_the_dir.pl</a></h3>
130         <blockquote>Support for the zapdirs utility.&nbsp; This library
131 cleans out the directory that it is passed by removing files that are
132 not considered important (using "<a href="#filename%20helper">filename_helper.pl</a>
133 ").&nbsp; The list of important files is something you might want to
134 look at to ensure that you won't get burned by zapdirs.</blockquote>
135       </blockquote>
136       </td>
137     </tr>
138   </tbody>
139 </table>
140 </center>
141 <h3>&nbsp; </h3>
142 <center>
143 <table bgcolor="#330000" border="4" cellpadding="0" cellspacing="0"
144  cols="1" width="92%">
145   <tbody>
146     <tr>
147       <td>
148       <h2>Applications</h2>
149       <blockquote>
150         <h3> <a href="../text/add_cr.pl">add_cr.pl</a></h3>
151         <blockquote>Processes Unix format text files for pcdos by
152 forcing the line endings to be Carriage Return plus Line Feed (CRLF).</blockquote>
153         <h4> </h4>
154         <h3><a href="../cgi/cgi_display.pl">cgi_display.pl</a></h3>
155         <blockquote>Turns the files passed on the command line into a
156 stream of CGI compatible text output. The javascript show_file method
157 (see the
158 source for this page) is preferred since it is lighter weight and
159 doesn't
160 need cgi, but there are some situations where cgi is the only option
161 (older
162 browsers or requirements of no javascript).</blockquote>
163         <h4> </h4>
164         <h3> <a href="../files/change_endings.pl">change_endings.pl</a></h3>
165         <blockquote>Replaces the suffix of all filenames in the current
166 directory
167 with a different suffix. &nbsp;Suffix here is defined as the set of
168 characters
169 after the last period ('.') in the name. &nbsp;Note this will not work
170 for
171 names without suffices.</blockquote>
172         <h3> </h3>
173         <h3><a href="../text/cpdiff.pl">cpdiff.pl</a></h3>
174         <blockquote>Copies files from a source directory into a
175 destination directory.&nbsp; The files are only copied when they are
176 missing in the destination or when the destination version has
177 different contents.&nbsp; The syntax looks like this:<br>
178 &nbsp;&nbsp;&nbsp; cpdiff&nbsp; source&nbsp; destination<br>
179 The assumption is that the files in the source directory are somehow
180 better, newer or more complete than the set of files in the destination.<br>
181         </blockquote>
182         <h3><a href="../text/cpdiffnow.pl">cpdiffnow.pl</a></h3>
183         <blockquote> Similar to cpdiff, but this utility sets the
184 destination file's time stamp to "now".&nbsp; This should cause the new
185 or changed files in the destination directory to be more recent than
186 anything else in there.&nbsp; This is helpful sometimes for forcing
187 compilation of modified source files.<br>
188         </blockquote>
189         <h4> </h4>
190         <h3><a href="../rev_control/cvs_fix.pl">cvs_fix.pl</a></h3>
191         <blockquote>Wraps the cygwin cvs command for pcdos/win32.
192 &nbsp;Any
193 unfriendly backward slashes are flipped to be forward slashes.<br>
194         </blockquote>
195         <h3> </h3>
196         <h3><a name="differ"></a><a
197  href="../text/differ.pl">differ.pl</a></h3>
198         <blockquote>Compares two directory hierarchies and the files
199 they
200 contain.&nbsp; The first parameter is a directory
201 to compare against "this" directory;
202 every subdirectory "here" will be traversed in order to build the
203 output file that shows the differences.&nbsp; An optional second
204 argument can be used to specify a different directory than the current
205 one as the source of the comparison (the first argument is always the
206 destination of the comparison).</blockquote>
207         <h3> <a href="../files/filedump.pl">filedump.pl</a></h3>
208         <blockquote>Collects the contents of the files whose names are
209 passed on the command line into one gigundo stream which is passed to
210 standard output. The output can be piped into another file as desired.</blockquote>
211         <h3> <a href="../core/generate_aliases.pl">generate_aliases.pl</a></h3>
212         <blockquote>Performs some useful activities for the shell
213 environment.&nbsp; Using the environment variable for FEISTY_MEOW_SCRIPTS (which
214 is set in the appropriate startup files to be the shell scripts
215 directory, where all this stuff lives), generate_aliases will create
216 all of the aliases files for the combinations of operating systems and
217 types of shells supported.&nbsp; Currently this includes Linux, Unix,
218 PCDOS, OS/2 and MS-WIN32 (9x, NT, 2K, XP, etc) for
219 supported operating systems.&nbsp; The shell languages supported are
220 dos's command, nt's cmd, unix's sh and bash, and perl.&nbsp; This script will also look for
221 any files ending in ".sh" or ".pl" and it will create aliases for them
222 in forms appropriate to the different shells. &nbsp;The .zz_feisty_loading
223 subdirectory is created under the home directory as a storage place for the generated script
224 files.</blockquote>
225         <h4> </h4>
226         <h3> <a href="../text/new_sig.pl">new_sig.pl</a></h3>
227         <blockquote>Generates a signature file from the nechung
228 database
229 using the 'nechung' application. &nbsp;See the <a
230  href="http://feistymeow.org/">Feisty Meow Concerns Codebase</a> for the nechung
231 application.
232 &nbsp;The database for nechung resides in the <a href="#download">whole Feisty Meow Concerns code package</a> in "feisty_meow/infobase".</blockquote>
233         <h3> </h3>
234         <h3> <a href="../files/renlower.pl">renlower.pl</a></h3>
235         <blockquote>Renames all of the files passed on the command line
236 such that they are only in lower-case.&nbsp; Useful if you're tired of
237 passing mistakenly re-capitalized names from a defective 8.3 OS (e.g.
238 Doze95/98) to
239 a file system where you care about the case.</blockquote>
240         <h3><a href="../processes/runner.pl">runner.pl</a></h3>
241         <blockquote>Finds all executable files in the current directory
242 (and subdirectories) and runs them.&nbsp; The output of the programs is
243 sent to standard output.&nbsp; Standard error is used to report which
244 file is being worked on, plus the running programs' own standard error
245 streams are merged into runner's standard error stream.&nbsp; This
246 makes it nice to do something like:<br>
247 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; runner &gt;runs.log<br>
248 where the runs.log file will contain the output of each program that
249 was executed and the console will be sent messages as each program is
250 started and finished (and errors show up at the console also).<br>
251         </blockquote>
252         <h3> <a name="safedel"></a><a
253  href="../files/safedel.pl">safedel.pl</a></h3>
254         <blockquote>Makes deleting files and directories a little less
255 nerve-wracking.&nbsp; If you substitute safedel as an alias for rm or
256 del or deltree or whatever, it will make a zipped backup of the items
257 before they are actually deleted.&nbsp; Safedel keeps track of a number
258 that is attached to each zip to enforce uniquely numbered
259 archives.&nbsp; They are stored in a directory named "zz_safedel_keep"
260 that is stored under the temorary directory (specified by the
261 environment
262 variable named TMP).&nbsp; A report of the contents of the compressed
263 trash
264 is appended to a file named "zz_safedel.rpt" in the TMP directory.&nbsp;
265 Occasional
266 cleaning of the deleted files folder is recommend, but this utility has
267 saved
268 my various parts several times already.</blockquote>
269         <h4> </h4>
270         <h3> </h3>
271         <h3><a href="../archival/snarf_linux_config.pl">snarf_linux_config.pl</a></h3>
272         <blockquote>A snarf utility that packages up the
273 important configuration files in a Linux installation.</blockquote>
274         <h4> </h4>
275         <h3> <a href="../archival/snarf_light.pl">snarf_light.pl</a></h3>
276         <blockquote>A selective snarf of the source hierarchy.&nbsp;
277 This
278 collects the code that I manage.&nbsp; As such, this is probably
279 irrelevant to anyone but CAK.</blockquote>
280         <h3><a href="../archival/snarf_notes.pl">snarf_notes.pl</a></h3>
281         <blockquote>Gathers all "important" files from the home
282 directory.
283 &nbsp;This
284 is somewhat personally tuned but it includes files and directories that
285 have
286 "project", "notes", or "crucial" in their name.</blockquote>
287         <h3> </h3>
288         <h3> <a href="../archival/snarf_src.pl">snarf_src.pl</a></h3>
289         <blockquote>A source code grabbing snarfer.&nbsp; The entire
290 source
291 code hierarchy is snarfed.&nbsp; Note that one should edit the
292 hierarchy
293 location to make it appropriate for your local source code.</blockquote>
294
295         <h3><a href="../files/summing_dir.pl">summing_dir.pl</a></h3>
296         <blockquote>Offers a directory listing along with total file
297 sizes
298 and disk free space.<br>
299           <br>
300         </blockquote>
301         <h3><a href="../build/synch_build.pl">synch_build.pl</a></h3>
302         <blockquote>This is a helper utility that synchronizes the binary
303 outputs from a build process with an existing installed location.&nbsp; Given a target directory, the executable
304 programs and dynamic libraries that exist there will be synchronized
305 with the build repository's versions.&nbsp; This is kind of a quickie
306 upgrade process, as long as the files in the target location are not
307 locked by other processes.<br>
308         </blockquote>
309         <h3> <a href="../archival/unsnarf.pl">unsnarf.pl</a></h3>
310         <blockquote>Uses the snarfer utilities to undo a previously
311 snarfed file.&nbsp; A folder named "snarf_BASE" is created for the
312 contents, where BASE
313 is replaced with the basename of the snarf file (that is, without the
314 ".snarf"
315 suffix).&nbsp; The number that tracks the snarf files of this type is
316 updated
317 such that the next snarf file will be at least one higher than this
318 snarf's
319 sorta
320 unique number.&nbsp; The number will be managed correctly if you're
321 always
322 unsnarfing the most recent snarf files before creating any new snarfs.</blockquote>
323         <h4> </h4>
324         <h3> <a href="../files/whack_forever.pl">whack_forever.pl</a></h3>
325         <blockquote>Since all of my file deletion commands are aliases
326 to <a href="#safedel">safedel</a>, it is hard to actually remove a
327 file. &nbsp;If I'm really really sure that a file or directory needs to
328 be
329 permanently deleted, then this command can be used. &nbsp;It shows the
330 names
331 it is removing also, but it does _not_ ask for confirmation.</blockquote>
332         <h3> </h3>
333         <h3><a href="../security/y2038_check.pl">y2038_check.pl</a></h3>
334         <div style="margin-left: 40px;">Tests the system for survival
335 past the year 2038, which is when the Unix time scale runs out of bits
336 for the number of seconds since 1970 measured in a 32 bit integer.<br>
337         </div>
338         <h3><a href="../files/zapdirs.pl">zapdirs.pl</a></h3>
339         <blockquote>Removes empty directories and directories
340 containing only
341 unimportant crud (see "<a href="#filename%20helper">filename_helper.pl</a>").&nbsp;
342 If there are no arguments, then the current directory is cleaned up;
343 any subdirectories
344 will be traversed into and removed if it seems appropriate.&nbsp;
345 Otherwise,
346 zapdirs operates on the arguments passed to it as if they are directory
347 names
348 to be cleaned.</blockquote>
349       </blockquote>
350       </td>
351     </tr>
352   </tbody>
353 </table>
354 <h3>&nbsp;</h3>
355 </center>
356 </body>
357 </html>