http://www.perlmonks.org?node_id=759294


in reply to New to me crash message

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:

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.

Replies are listed 'Best First'.
Re^2: New to me crash message
by ikegami (Patriarch) on Apr 22, 2009 at 15:00 UTC

    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...

    He's using at least one source filter. As previously suggested, the first act should be to see if the bug occurs without loading any modules.

      Am about to fire off a 'use' free version of the code. Am anxious myself to see what happens--- hope it perturbs the dime for me.

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."