Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

my first 2-html html::zoom thing

View gist:340590
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
#!/usr/bin/perl
use strict;
use warnings;
use HTML::Zoom;
 
my $html = <<HTML;
<html>
<head>
<title>Hello people</title>
</head>
<body>
<div id="content"></div>
</body>
</html>
HTML
 
my $body = <<HTML;
<h1 id="greeting">Placeholder</h1>
<div id="list">
<span>
<p>Name: <span class="name">Bob</span></p>
<p>Age: <span class="age">23</span></p>
</span>
<hr class="between" />
</div>
HTML
 
my $html_zoom = HTML::Zoom->from_html($html)
->select('title')
->replace_content('Hello everybody');
 
my $body_zoom = HTML::Zoom->from_html($body)
->select('#greeting')
->replace_content('Hello everybody')
;
 
my $sum_zoom = $html_zoom->select('#content')
->append_content($body_zoom->{initial_events})
;
 
print $sum_zoom->to_html;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.