Subject: | End dates parsing doesn't always work |
Date: | Sat, 1 Jun 2019 22:47:31 +0200 |
To: | bug-WWW-Search-Ebay [...] rt.cpan.org |
From: | Charlene Wendling <julianaito [...] posteo.jp> |
Hi,
During a review of an OpenBSD port update for WWW-Search-Ebay to 3.052,
Andrew Fresh found out that end_date is sometimes undefined [0].
For example when running (same with different search terms, see
attached log):
AutoSearch --engine Ebay -n BSD -s bsd bsd
It generates several 'Use of uninitialized value in numeric lt (<)
at /usr/local/libdata/perl5/site_perl/WWW/Search/Ebay.pm line 672.'
This could be fixed with the patch below, but it may hide another
issue.
I tried to pinpoint it - i thought it was because ebay seems to add
various empty <span id>, to break reliable parsing of the end of the
auction. But you're using 'timems' attribute instead.
I hope it helps.
Charlène.
[0] https://marc.info/?l=openbsd-ports&m=155918348013672&w=2
$OpenBSD$
Index: lib/WWW/Search/Ebay.pm
--- lib/WWW/Search/Ebay.pm.orig
+++ lib/WWW/Search/Ebay.pm
@@ -669,7 +669,7 @@ sub result_as_HTML
my $dateNow = ParseDate('now');
print STDERR " DDD compare end_date ==$dateEnd==\n" if (DEBUG_DATES || (1 < $self->{_debug}));
print STDERR " DDD compare date_now ==$dateNow==\n" if (DEBUG_DATES || (1 < $self->{_debug}));
- if (Date_Cmp($dateEnd, $dateNow) < 0)
+ if ((Date_Cmp($dateEnd, $dateNow) || 0) < 0)
{
$sEndedColor = 'red';
$sEndedWord = 'ended';
@@ -1040,7 +1040,7 @@ sub _parse_tree
&&
(0 < $iBids) # Item got any bids
&&
- (Date_Cmp($enddate, 'now') < 0) # Item is ended
+ ((Date_Cmp($enddate, 'now') || 0) < 0) # Item is ended
)
{
# Item must have been sold!?!
Message body not shown because it is not plain text.