Note to self: add and subtract modify the calling object. Use clone if you just want to use the result.
So do not write this:
my $today = DateTime->now;
my $yesterday = $today->subtract( days => 1);# changes $today
Instead write this:
my $today = DateTime->now;
my $yesterday = $today->clone->subtract( days => 1); # note the 'clone' call
So I just got this USB 3G device, a modem that's supposed to connect me to the World when I am out here on the Tuscan hills. Of course it came with Windows drivers and I don't have a Windows machine, so I plugged it on the Mac and hoped it worked, as usually happens... no dice. You need a driver. Then I tried to install the linux driver that Vodafone gently provides on the (linux) EEE... but I was missing some libraries, and I couldn't get it to run. Grrr... yet an other case of Linux being unfriendly to recent hardware I guessed!
Then finally "en de'sespoir de cause", I just plugged the device into the darn machine... and low and behold... it Just Worked (tm)! The EEE comes with a piece of software that recognizes my modem, brings up a nice popup and connects me to the rest of the World, from that remote, DSL (and phone!)-deprived area on the Apuan Alps. Yay for Linux! Friendlier than the Mac (and even Windows needs some additional piece of software to be installed I think).
Sorry Pudge...
An other reason why subroutine should always end with an explicit return.
XML::Twig has this XML::Parser handler for characters that ends
(or rather used to end!) with $elt->{pcdata}
In the end, adding a return at the end of the handler took processing time from 581s to... 2s. It probably improves speed in less specific cases.
And yes, it is one of Perl Best Practices recommendations (although not for performance reasons). So were was the PBP in 1997 when I wrote the first version of XML::Twig?