#!/usr/bin/perl

use Storable ();
open( my $null_fh, '<', '/dev/null' );
eval '
	local $SIG{__DIE__};
	local $SIG{__WARN__};
	Storable::pretrieve($null_fh);
';
if ( $@ =~ m/Not enough arguments/i ) {
    open( my $pwcache_fh, '<', '/usr/local/cpanel/Cpanel/PwCache.pm' );
    {
        print "Storable is not in sync.  Reinstalling and forcing update.\n";
        local $/;
        my $pwcache_text = readline($pwcache_fh);
        if ( $pwcache_text =~ m/Storable::pretrieve/ ) {
            system '/usr/local/cpanel/scripts/perlinstaller', '--force', 'Storable';
            system '/usr/local/cpanel/scripts/upcp';
        }
    }
}
