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.
ADPLogger.pm | December 11, 2009 10:36:27 PM UTC | 32924 bytes | ADPLogger.pm.html | ADPLogger.pm.pod.html | 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. |
BayesianTokenCounter.pm | December 11, 2009 10:36:28 PM UTC | 43094 bytes | BayesianTokenCounter.pm.html | BayesianTokenCounter.pm.pod.html | I wrote this to parse email files with PMMail. I used the results to classify email as SPAM, or not SPAM. |
CommandLineProcessor.pm | December 11, 2009 10:36:29 PM UTC | 22189 bytes | CommandLineProcessor.pm.html | CommandLineProcessor.pm.pod.html | |
ConfigFileParser.pm | December 11, 2009 10:36:29 PM UTC | 20116 bytes | ConfigFileParser.pm.html | ConfigFileParser.pm.pod.html | 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. |
DateUtil.pm | December 11, 2009 10:36:30 PM UTC | 17263 bytes | DateUtil.pm.html | DateUtil.pm.pod.html | Provides easy formatting of dates and times, and also, the conversion of a formatted date and time back to the system representation. See also test_strings_and_dates.pl and test_year_2038.pl. |
DeepCopy.pm | December 11, 2009 10:36:30 PM UTC | 3253 bytes | DeepCopy.pm.html | DeepCopy.pm.pod.html | 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. |
SafeGlob.pm | December 11, 2009 10:36:30 PM UTC | 17079 bytes | SafeGlob.pm.html | SafeGlob.pm.pod.html | 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. |
SmallLogger.pm | December 11, 2009 10:36:31 PM UTC | 35725 bytes | SmallLogger.pm.html | SmallLogger.pm.pod.html | Simple log class with output to the screen or file. Uses my XMLUtil library, which uses the XML::Parser, for configuration. |
SmallLoggerNoXML.pm | December 11, 2009 10:36:32 PM UTC | 29518 bytes | SmallLoggerNoXML.pm.html | SmallLoggerNoXML.pm.pod.html | 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. |
SocketUtil.pm | December 11, 2009 10:36:32 PM UTC | 32282 bytes | SocketUtil.pm.html | SocketUtil.pm.pod.html | 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. |
StringUtil.pm | December 11, 2009 10:36:33 PM UTC | 30883 bytes | StringUtil.pm.html | StringUtil.pm.pod.html | 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. |
XMLUtil.pm | December 11, 2009 10:36:33 PM UTC | 15244 bytes | XMLUtil.pm.html | XMLUtil.pm.pod.html | Convert arbitrary objects to and from XML. I am not certain how useful the library is, but it demonstrates how to recognize object types. |