8eaad2882af5744863c48086a3a005419db317dd
[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
190         <h3> </h3>
191         <h3><a name="differ"></a><a
192  href="../text/differ.pl">differ.pl</a></h3>
193         <blockquote>Compares two directory hierarchies and the files
194 they
195 contain.&nbsp; The first parameter is a directory
196 to compare against "this" directory;
197 every subdirectory "here" will be traversed in order to build the
198 output file that shows the differences.&nbsp; An optional second
199 argument can be used to specify a different directory than the current
200 one as the source of the comparison (the first argument is always the
201 destination of the comparison).</blockquote>
202         <h3> <a href="../files/filedump.pl">filedump.pl</a></h3>
203         <blockquote>Collects the contents of the files whose names are
204 passed on the command line into one gigundo stream which is passed to
205 standard output. The output can be piped into another file as desired.</blockquote>
206         <h3> <a href="../core/generate_aliases.pl">generate_aliases.pl</a></h3>
207         <blockquote>Performs some useful activities for the shell
208 environment.&nbsp; Using the environment variable for FEISTY_MEOW_SCRIPTS (which
209 is set in the appropriate startup files to be the shell scripts
210 directory, where all this stuff lives), generate_aliases will create
211 all of the aliases files for the combinations of operating systems and
212 types of shells supported.&nbsp; Currently this includes Linux, Unix,
213 PCDOS, OS/2 and MS-WIN32 (9x, NT, 2K, XP, etc) for
214 supported operating systems.&nbsp; The shell languages supported are
215 dos's command, nt's cmd, unix's sh and bash, and perl.&nbsp; This script will also look for
216 any files ending in ".sh" or ".pl" and it will create aliases for them
217 in forms appropriate to the different shells. &nbsp;The .zz_feisty_loading
218 subdirectory is created under the home directory as a storage place for the generated script
219 files.</blockquote>
220         <h4> </h4>
221         <h3> <a href="../text/new_sig.pl">new_sig.pl</a></h3>
222         <blockquote>Generates a signature file from the nechung
223 database
224 using the 'nechung' application. &nbsp;See the <a
225  href="http://feistymeow.org/">Feisty Meow Concerns Codebase</a> for the nechung
226 application.
227 &nbsp;The database for nechung resides in the <a href="#download">whole Feisty Meow Concerns code package</a> in "feisty_meow/infobase".</blockquote>
228         <h3> </h3>
229         <h3> <a href="../files/renlower.pl">renlower.pl</a></h3>
230         <blockquote>Renames all of the files passed on the command line
231 such that they are only in lower-case.&nbsp; Useful if you're tired of
232 passing mistakenly re-capitalized names from a defective 8.3 OS (e.g.
233 Doze95/98) to
234 a file system where you care about the case.</blockquote>
235         <h3><a href="../processes/runner.pl">runner.pl</a></h3>
236         <blockquote>Finds all executable files in the current directory
237 (and subdirectories) and runs them.&nbsp; The output of the programs is
238 sent to standard output.&nbsp; Standard error is used to report which
239 file is being worked on, plus the running programs' own standard error
240 streams are merged into runner's standard error stream.&nbsp; This
241 makes it nice to do something like:<br>
242 &nbsp;&nbsp;&nbsp; &nbsp;&nbsp; runner &gt;runs.log<br>
243 where the runs.log file will contain the output of each program that
244 was executed and the console will be sent messages as each program is
245 started and finished (and errors show up at the console also).<br>
246         </blockquote>
247         <h3> <a name="safedel"></a><a
248  href="../files/safedel.pl">safedel.pl</a></h3>
249         <blockquote>Makes deleting files and directories a little less
250 nerve-wracking.&nbsp; If you substitute safedel as an alias for rm or
251 del or deltree or whatever, it will make a zipped backup of the items
252 before they are actually deleted.&nbsp; Safedel keeps track of a number
253 that is attached to each zip to enforce uniquely numbered
254 archives.&nbsp; They are stored in a directory named "zz_safedel_keep"
255 that is stored under the temorary directory (specified by the
256 environment
257 variable named TMP).&nbsp; A report of the contents of the compressed
258 trash
259 is appended to a file named "zz_safedel.rpt" in the TMP directory.&nbsp;
260 Occasional
261 cleaning of the deleted files folder is recommend, but this utility has
262 saved
263 my various parts several times already.</blockquote>
264         <h4> </h4>
265         <h3> </h3>
266         <h3><a href="../archival/snarf_linux_config.pl">snarf_linux_config.pl</a></h3>
267         <blockquote>A snarf utility that packages up the
268 important configuration files in a Linux installation.</blockquote>
269         <h4> </h4>
270         <h3> <a href="../archival/snarf_light.pl">snarf_light.pl</a></h3>
271         <blockquote>A selective snarf of the source hierarchy.&nbsp;
272 This
273 collects the code that I manage.&nbsp; As such, this is probably
274 irrelevant to anyone but CAK.</blockquote>
275         <h3><a href="../archival/snarf_notes.pl">snarf_notes.pl</a></h3>
276         <blockquote>Gathers all "important" files from the home
277 directory.
278 &nbsp;This
279 is somewhat personally tuned but it includes files and directories that
280 have
281 "project", "notes", or "crucial" in their name.</blockquote>
282         <h3> </h3>
283         <h3> <a href="../archival/snarf_src.pl">snarf_src.pl</a></h3>
284         <blockquote>A source code grabbing snarfer.&nbsp; The entire
285 source
286 code hierarchy is snarfed.&nbsp; Note that one should edit the
287 hierarchy
288 location to make it appropriate for your local source code.</blockquote>
289
290         <h3><a href="../files/summing_dir.pl">summing_dir.pl</a></h3>
291         <blockquote>Offers a directory listing along with total file
292 sizes
293 and disk free space.<br>
294           <br>
295         </blockquote>
296         <h3><a href="../build/synch_build.pl">synch_build.pl</a></h3>
297         <blockquote>This is a helper utility that synchronizes the binary
298 outputs from a build process with an existing installed location.&nbsp; Given a target directory, the executable
299 programs and dynamic libraries that exist there will be synchronized
300 with the build repository's versions.&nbsp; This is kind of a quickie
301 upgrade process, as long as the files in the target location are not
302 locked by other processes.<br>
303         </blockquote>
304         <h3> <a href="../archival/unsnarf.pl">unsnarf.pl</a></h3>
305         <blockquote>Uses the snarfer utilities to undo a previously
306 snarfed file.&nbsp; A folder named "snarf_BASE" is created for the
307 contents, where BASE
308 is replaced with the basename of the snarf file (that is, without the
309 ".snarf"
310 suffix).&nbsp; The number that tracks the snarf files of this type is
311 updated
312 such that the next snarf file will be at least one higher than this
313 snarf's
314 sorta
315 unique number.&nbsp; The number will be managed correctly if you're
316 always
317 unsnarfing the most recent snarf files before creating any new snarfs.</blockquote>
318         <h4> </h4>
319         <h3> <a href="../files/whack_forever.pl">whack_forever.pl</a></h3>
320         <blockquote>Since all of my file deletion commands are aliases
321 to <a href="#safedel">safedel</a>, it is hard to actually remove a
322 file. &nbsp;If I'm really really sure that a file or directory needs to
323 be
324 permanently deleted, then this command can be used. &nbsp;It shows the
325 names
326 it is removing also, but it does _not_ ask for confirmation.</blockquote>
327         <h3> </h3>
328         <h3><a href="../security/y2038_check.pl">y2038_check.pl</a></h3>
329         <div style="margin-left: 40px;">Tests the system for survival
330 past the year 2038, which is when the Unix time scale runs out of bits
331 for the number of seconds since 1970 measured in a 32 bit integer.<br>
332         </div>
333         <h3><a href="../files/zapdirs.pl">zapdirs.pl</a></h3>
334         <blockquote>Removes empty directories and directories
335 containing only
336 unimportant crud (see "<a href="#filename%20helper">filename_helper.pl</a>").&nbsp;
337 If there are no arguments, then the current directory is cleaned up;
338 any subdirectories
339 will be traversed into and removed if it seems appropriate.&nbsp;
340 Otherwise,
341 zapdirs operates on the arguments passed to it as if they are directory
342 names
343 to be cleaned.</blockquote>
344       </blockquote>
345       </td>
346     </tr>
347   </tbody>
348 </table>
349 <h3>&nbsp;</h3>
350 </center>
351 </body>
352 </html>