Skip Menu |

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

Report information
The Basics
Id: 81682
Status: new
Priority: 0/
Queue: HTML-Tiny

People
Owner: Nobody in particular
Requestors: g [...] b4.vu
Cc:
AdminCc:

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



Subject: object references are mistakenly treated same as empty arrayrefs
Date: Tue, 4 Dec 2012 18:07:16 +1030
To: bug-HTML-Tiny [...] rt.cpan.org
From: "Geoffrey D. Bennett" <g [...] b4.vu>
Hi there, HTML::Tiny::_attr seems to treat objects in the same way that empty arrayrefs should be treated (generating an empty attribute). perl -d -MURI -MHTML::Tiny -e0 DB<1> $u = URI->new("http://example/") DB<2> print $u http://example/ DB<3> print HTML::Tiny->new->a({href=>$u}) <a href="href"></a> DB<4> print HTML::Tiny->new->a({href=>"$u"}) <a href="http://example/"></a> It would be nice if objects got stringified automatically, maybe: --- HTML/Tiny.pm-old 2009-03-09 03:37:58.000000000 +1000 +++ HTML/Tiny.pm-new 2012-12-04 17:34:55.178971286 +1000 @@ -622,7 +622,7 @@ sub _attr { my ( $self, $attr, $val ) = @_; - if ( ref $val ) { + if ( ref $val and ref $val eq 'ARRAY' ) { return $attr if not $self->_xml_mode; $val = $attr; } Thanks, Geoffrey.