Poking around in the source, I find that the error:
Can't coerce UNKNOWN to string in aelem ... line 68 ...
is generated when
Perl_sv_pvn_force_flags is presented with a value which is an Array, Hash, Code or IO or some completely bogus type: (
SvTYPE(sv) > SVt_PVLV && SvTYPE(sv) != SVt_PVFM).
The lines around the reported error location are:
67: if (defined($text->[0])) {
68: my @text = collapse(@$text);
69: print $fh_ERR "$url|", join( ",", @text ), "\n";
70: }
The aelem suggests that the error is in an array element look up... however, things are all a bit mysterious:
there an array look up on line 67, but not on line 68.
I'm not convinced I can think of a case where aelem would be doing a force to string (PV).
I cannot see anywhere where defined would set about forcing to PV
the join on line 69 looks like the best candidate for forcing to PV -- but I don't see a good reason for the error being reported on the wrong line or in the wrong operation...
the reported UNKNOWN type is a BIG WORRY... because it indicates that whatever the SV is that is being forced to string, it's not of any type known to Perl -- which suggests something has gang awry in an omigod-could-this-be-a-bug-in-Perl sort of a way.
It could be time to get out the debugger and place a breakpoint on the:
if (SvTYPE(sv) > SVt_PVLV && SvTYPE(sv) != SVt_PVFM)
Perl_croak(aTHX_ "Can't coerce %s to string in %s",
sv_reftype(sv,0),
OP_NAME(PL_op));
in
Perl_sv_pvn_force_flags and having a poke around in the entrails.