Skip Menu |

This queue is for tickets about the HTML-Tree CPAN distribution.

Report information
The Basics
Id: 35948
Status: resolved
Priority: 0/
Queue: HTML-Tree

People
Owner: Nobody in particular
Requestors: colin.fine [...] pace.co.uk
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 3.23
Fixed in: (no value)



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'};
Hi, I made the following changes: if ( ref $node ) { # it's an element + + # detect bogus classes. RT #35948 + $node->isa( $self->element_class ) + or Carp::confess( "Object of class " + . ref($node) + . " cannot be processed by HTML::Element" ); $tag = $node->{'_tag'}; This should allow sub classing to function as expected. Cheers, Jeff.
On Sun Sep 19 05:55:09 2010, jfearn wrote: Show quoted text
> Hi, I made the following changes: >
Show quoted text
> > This should allow sub classing to function as expected. > > Cheers, Jeff.
Thanks. At this time depth, I have no idea what I was doing, and cannot hope to recreate the problem to test the fix, but that looks right. Colin Fine
Subject: 4.0 released
Hi HTML::Tree ve4rsion 4.0 has been released which includes a fix for this issue. Cheers, Jeff.