Software Development

Perl Subroutine for Logging

I have a perl subroutine that I use often to create a log file for my scripts. #!/bin/perl ############################################################# # ############################################################# use Time::localtime; $LOG_LOCATION="/var/log"; $LOG_FILE_PREFIX="myscript"; logMessage("This is a test"); ############################################################# # Returns logfile = /var/log/myscriptYYYYMMDD.log ############################################################# sub getLogFilename() { my $currentYear; my $currentMonth; my $currentDay; my $targetFilename; my $currentDateStat; $currentDateStat = localtime; $currentYear = $currentDateStat->year

spacer

Robert’s Golden Rules on Objects

For those who find Object-Oriented Design difficult then the following rules will assist you: Object exists for a purpose Object has responsibilities Delegation is the key to success Keep interfaces simple So, “I live to eat” “I live to sleep” “I live to reproduce”

spacer

What is an object

The Sun’s definition of an object is one of many forms. Though, not entirely applicable in all cases. For example, a singleton service object may not need to hold any state, base on Sun’s examples. It may have one or more interfaces that invoke by the client. Once the invocation has completed, no data is

spacer