Menu

#33 $abstract not defined in Harvest/Reaper/Summarise/HTML.pm

open
nobody
None
5
2003-09-24
2003-09-24
No

In the source for Harvest/Reaper/Summarise/HTML.pm,
$abstract is not (always) available by the time
execution reaches line 290:

# FIXME: This shouldn't be here.
if (!defined($obj->metadata->get('description'))) {
my $desc=substr $abstract,0,240;
$desc=$desc." ..." if ($desc ne $abstract);
$obj->metadata->set("description", $desc);
}

I can't see any reference to $abstract anywhere in the
code preceding this, except in "undef $abstract". I
assume the parser is supposed to poulate this variable,
but seemingly doesn't.

As a workaround, I wrapped the above code in an if-defined:

# FIXME: This shouldn't be here.
if (!defined($obj->metadata->get('description'))) {
if(defined($abstract))
{
my $desc=substr $abstract,0,240;
$desc=$desc." ..." if ($desc ne $abstract);
$obj->metadata->set("description", $desc);
}
else
{
$obj->metadata->set("description", "");
}
}

...hardly perfect, but stops the warnings during reaping.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB