Russell C.
Russell C.

Reputation: 1659

Suppressing "Day too big" warning in Perl LWP::UserAgent

I have a fairly simple perl script with uses the LWP::UserAgent module to follow URLs through redirection to find the final destination URL which it then stores in our MySQL database. The problem is that from time to time the script reports warnings that look like this:

Day too big - 25592 > 24855
Sec too small - 25592 < 74752
Sec too big - 25592 > 11647
Day too big - 25592 > 24855
Sec too small - 25592 < 74752
Sec too big - 25592 > 11647

The warnings don't provide any other details as to why this is happening or which module is causing the issue but I'm pretty sure it has to do with LWP::UserAgent.

I'm initializing the agent using the following code:

use LWP::UserAgent;
my $ua = LWP::UserAgent->new(cookie_jar => { },requests_redirectable => [ ]);
$ua->agent('Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:9.9.9.9) Gecko/20079999 Firefox/2.0.0.1');
$ua->timeout(10);

I searched online and the only result I found was to the following thread which was never resolved http://www.mail-archive.com/[email protected]/msg06515.html. The thread author thought that these warning were somehow related to cookie dates being captured by the LWP::UserAgent module.

The warning doesn't seem to be effecting the script but I would appreciate any help in better understanding what might be causing this issue and advice on how to resolve it or at least suppress the warning messages. Thanks in advance for your help!

Upvotes: 3

Views: 2108

Answers (2)

hillu
hillu

Reputation: 9611

If upgrading is not an option for you, you can, of course always filter out the warnings using a local $SIG{__WARN__} handler.

{
    local $SIG{__WARN__} = sub {
        warn @_ unless $_[0] =~ m(^.* too (?:big|small));
    };
    # your code here.
}

Upvotes: 7

Sinan &#220;n&#252;r
Sinan &#220;n&#252;r

Reputation: 118118

See Changes:

2009-10-06 Release 5.833

Gisle Aas (5):

  • Deal with cookies that expire far into the future [RT#50147]
  • Deal with cookies that expire at or before epoch [RT#49467]

It looks like you need to upgrade to the most recent version of LWP.

Upvotes: 5

Related Questions