Suppressing "Day Too Big" Warning in Perl LWP :: UserAgent

I have a pretty simple perl script using the LWP :: UserAgent module to track URLs through a redirect 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 do not contain any other details about why this is happening or which module is causing the problem, but I'm sure this is related to LWP :: UserAgent.

I initialize 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);

, , , , http://www.mail-archive.com/libwww@perl.org/msg06515.html. , - cookie, LWP:: UserAgent.

, , script, , , , . !

+3
2

, , , local $SIG{__WARN__}.

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

. Changes:

2009-10-06 5.833

Gisle Aas (5):

  • , [RT # 50147]
  • cookie, [RT # 49467]

, LWP.

+5

Source: https://habr.com/ru/post/1731034/


All Articles