- That can't happen.
- That doesn't happen on my machine.
- That shouldn't happen.
- Why is that happening?
- Oh, I see.
- How did that ever work?
Using search.cpan.org there are many options to logging to a file. Finding just one that does exactly what you need can be a challenge.
Here, I will talk just about one: Log::LogLite
LogLite was almost exactly what I was looking for, but I found it to be lacking in one area: The date output formatting was most useless, and not customizable. "YYYY-DD-MM"!? Why not YYYY-MM-DD like most computer programmers like, since it alpha sorts correctly?
A simple change near line 69 like so:
my $line = $self->{TEMPLATE}; $line =~ s!<date>!$self->date_string()!igoe; # changed to $self->date_string() so module can be customized by deriving from.
And now I can derive modules from Log::LogLite and customize the date formatting.
package MyLog; use Log::LogLite; @ISA = ("Log::LogLite"); sub date_string { my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); return sprintf( "%02d/%02d/%04d %02d:%02d:%02d", $mon + 1, $mday, $year + 1900, $hour, $min, $sec ); } # of date_string
But since I have to modify the original module in order to have the flexibility to customize it, I just renamed the module LogLite.pm to MyLog.pm, made the above two changes and copy it around to where I need it.
So much for code reuse.
The Internet Storm Center monitors the state of the Internet, and reports when there are problems due to worms or DOS (Denial Of Service) attacks.
What’s that you say? You’ve never been asked that before? I bet you have, but you didn’t hear the question!
Go to any fast food restaurant, order french fries, and you’ll be asked “Would you like some Ketchup?“. That’s the question that you’ll hear. The actual question is, “Would you like the rest of the Ketchup?” Go ahead, answer yes. And here comes the heaping pile of Ketchup you wanted!
I wish I could take credit for having “the rest of the Ketchup”, revealed to the world, but I can’t really. Larry Evans is the person that came up with it originally, and to him I give the rest of the credit!
At one point in time, free actually meant free. But nowadays I find myself more and more frequently not being able to afford the high cost of free. continue reading…
VMWare has a fantastic product (for what it does), allowing you to run other operating systems on top of your Microsoft Windows or Linux OS. It is great for trying out Linux distributions, and the “don’t save changes to the virtual hard drive” option makes Windows fantastic for testing out service packs and giving the viruses a safe system to infect while you figure out how to get rid of them.