3 # HTML::TreeBuilder invokes HTML::Entities::decode on the contents of
4 # HREF attributes. Some CGI-based sites use lang=en or such for
5 # internationalization. When this parameter is after an ampersand,
6 # the resulting &lang is decoded, breaking the link. "sub" is another
9 # Test provided by Rocco Caputo
14 use Test::More tests => 1;
15 use HTML::TreeBuilder;
17 my $tb = HTML::TreeBuilder->new();
19 "<a href='http://wherever/moo.cgi?xyz=123&lang=en'>Test</a>"
22 my @links = $tb->look_down( sub { $_[0]->tag eq "a" } );
23 my $href = $links[0]->attr("href");
25 ok($href =~ /lang/, "href should contain 'lang' (is: $href)");