Subject: | Unhelpful message if I pass an arbitrary object in content. |
If I accidentally call push_content or equivalent with something that is
an object but not an HTML::Element (for example I have a class which
overrides "" and previously used the object in my HTML because it was in
string context, but now pass it as an argument to push_content, where it
is not in string context) I get the singularly unhelpful message
Unsupported method starttag call in <myclass>
Please can HTML::Element
1) test whether the object is right before calling starttag
2) confess, so that there is some hope of finding where the error is.
I suggest altering 'traverse' to include the three lines marked with ->
(after line 1590 in 3.23)
$self->traverse(
sub {
($node, $start) = @_;
if(ref $node) {
-> $node->isa('HTML::Element') or
-> Carp::confess("Object of class ".ref($node).
-> " cannot be processed by HTML::Element");
$tag = $node->{'_tag'};