]>
Commit | Line | Data |
---|---|---|
3dad7198 TB |
1 | # This might look like shell script, but it's actually -*- perl -*- |
2 | use strict; | |
3dad7198 TB |
3 | |
4 | use File::Slurp; | |
5 | use Test::More qw(no_plan); | |
6 | ||
3dad7198 TB |
7 | use HTML::TreeBuilder; |
8 | use HTML::Element::Library; | |
d4b9a41a | 9 | use Test::XML; |
3dad7198 TB |
10 | |
11 | sub replace_age { | |
12 | my $branch = shift; | |
13 | my $age = shift; | |
14 | $branch->look_down(id => 'age')->replace_content($age); | |
15 | } | |
16 | ||
17 | ||
18 | sub tage { | |
19 | ||
20 | my $root = "t/html/same_as/same_as"; | |
21 | ||
22 | my $tree = HTML::TreeBuilder->new_from_file("$root.initial"); | |
23 | ||
9b7a5679 | 24 | #warn "TREE: $tree" . $tree->as_HTML; |
3dad7198 | 25 | |
d9f4bd5a TB |
26 | my %data = (people_id => 888, phone => '444-4444', email => 'm@xml.com'); |
27 | ||
28 | $tree->hash_map | |
29 | (hash => \%data, | |
30 | to_attr => 'sid', | |
d4b9a41a | 31 | excluding => [ 'email' ] |
d9f4bd5a | 32 | ); |
3dad7198 | 33 | |
d4b9a41a | 34 | is_xml ($tree->as_XML, scalar File::Slurp::read_file("$root.exp"), "XML for same_as"); |
3dad7198 TB |
35 | } |
36 | ||
37 | ||
38 | tage(); |