We have a RHEL 5 box running some POE components that require the XS version of Scalar::Util.  However, the yum repos appear to have the non-XS version included, so every upgrade of perl breaks the Perl code that requires Scalar::Util.
The fix is here:

http://www.cybersprocket.com/2011/programming-languages/weaken-is-only-available-with-the-xs-version-of-scalarutil/

cpan
> force install Scalar::Util

But why is this? If you check out the “Diagnostics” section for Scalar::Util at CPAN, you’ll see:

NAME is only available with the XS version of Scalar::Util

Scalar::Util contains both perl and C implementations of many of its functions so that those without access to a C compiler may still use it. However some of the functions are only available when a C compiler was available to compile the XS version of the extension

Meaning – the update from yum must install the perl-only impelementation for cross-compatibility. What’s of most interest here is that “force install Scalar::Util” isn’t actually the full answer – you have to have gcc installed as well, so that there’s a C-compiler available during the CPAN forced reinstall. In case your production systems don’t have gcc installed already.

A quick CLI reference for perl people…

perl -e ' my @t=localtime(time() + $ARGV[0]*24*60*60); $t[4]++; $t[5]+=1900; print "$t[4]/$t[3]/$t[5]\n";' XX

I’ve needed this 2x today already, and hope it helps you!

Edit:
Someone made a comment, as people on the internet are prone to do, so here’s the long-form non-one-liner version:


#!/usr/bin/perl
my $addDays = shift;
my ($second, $minute, $hour, $day, $month, $year, $dayOfWeek, $dayOfYear, $daylightSavings) = localtime(time());
my ($fsecond, $fminute, $fhour, $fday, $fmonth, $fyear, $fdayOfWeek, $fdayOfYear, $fdaylightSavings) = localtime(time() + $addDays*24*60*60);

#fix 0 = 1 values, and "0 = 1900" problem:
$month++;
$fmonth++;
$year+=1900;
$fyear+=1900;

print "today is: $month/$day/$year\n";
print "$addDays days from today is: $fmonth/$fday/$fyear\n";

Run it as:

rob@laptop:~$ fdate.pl 50
today is: 1/25/2012
50 days from today is: 3/15/2012