Andrew Pitonyak MacrosDatabaseSpamPerlMy Perl UtilitiesVYMMiscMagic

I have two primary perl sections, my general utilities and my spam utilities. Just in case it is not obvious, the link general utilities loads a page that allows you to see these utilities including the source code. The other link, spam utilities, is for the same purpose.

General Utilites

Spam Utilites

These were written so that I could avoid spam on my computer. There is a better write-up here and the utilities are here.

Formatting And Extracting Dates And Times In Perl

There are two primary reasons that people come to my website if they do not already know me. The primary reason is of course Macro Programming using OpenOffice. The second reason is to try and figure out how to parse dates and times using PERL. If your only purpose in life is to format and use dates and times, then simply download a copy of my date utility code. You can see a pretty version of it if you like, or simply see how to use it.

If you want to do it the hard way - meaning you want to do it yourself - it is not that difficult. First, call the time() function to find out what time it is. Next, pass this value to localtime function to break this value into component pieces.

$a_time = time();
( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst ) = ( localtime($a_time) );

The returned year is the number of years from 1900, so the year 2004 is returned as 104. Boy did this annoy some of my PERL programming friends! I must admit that I used some interesting code in the time_date_str routine, take a look at it. If there is call for it, then I will provide some more information.

Pretty Version
Description December 11, 2009 10:36:27 PM UTC 32924 bytes This logger is able to configure itself using a ConfigFileParser, so a simpler configuration method exists. Also, the class is able to limit the log file size and create rolling log files. For example, if the maximum file size is 10K, you may have files named x.log, x.log.1, x.log.2, etc... each of size 10K or less. In this document, I only explain the small logger, but the code is very similar. December 11, 2009 10:36:28 PM UTC 43094 bytes I wrote this to parse email files with PMMail. I used the results to classify email as SPAM, or not SPAM. December 11, 2009 10:36:29 PM UTC 22189 bytes December 11, 2009 10:36:29 PM UTC 20116 bytes Read property files of the form "property = value". Many advanced capabilities are supported such as the ability to reference already defined properties. Advanced regular expressions are demonstrated to track things like an even or odd number of preceding escape characters. December 11, 2009 10:36:30 PM UTC 17263 bytes Provides easy formatting of dates and times, and also, the conversion of a formatted date and time back to the system representation. See also and December 11, 2009 10:36:30 PM UTC 3253 bytes A hash or array may contain a reference to an object. A hash or array copy continues to reference the original object. This library demonstrates how to copy references as a new object. December 11, 2009 10:36:30 PM UTC 17079 bytes The section begins by discussing on creating classes in PERL. The library itself, provides a method to find files and directories using file specs or regular expressions. The returned values can be done recursively. December 11, 2009 10:36:31 PM UTC 35725 bytes Simple log class with output to the screen or file. Uses my XMLUtil library, which uses the XML::Parser, for configuration. December 11, 2009 10:36:32 PM UTC 29518 bytes The SmallLogger, but without XML capabilities. For many things, this is sufficient, and you do not need to install the XML::Parser. This library is not listed or described in this document. December 11, 2009 10:36:32 PM UTC 32282 bytes Demonstrates how to read and write sockets with many details abstracted away. I found this library particularly useful for writing test harnesses to communicate with socket driven programs. December 11, 2009 10:36:33 PM UTC 30883 bytes String type utilities to format, remove space, and display numbers with leading zeros. Unexpected methods provide the ability to find the maximum width of all strings in an array or hash, or the ability to convert any object to a string. December 11, 2009 10:36:33 PM UTC 15244 bytes Convert arbitrary objects to and from XML. I am not certain how useful the library is, but it demonstrates how to recognize object types.

Last Modified July 5, 2010 02:00:37 PM UTC© 1999-2024 Andrew Pitonyak (email me at: andy @