Created
September 22, 2010 19:29
-
-
Save jjn1056/592333 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use strict; | |
use warnings; | |
use HTML::Zoom; | |
my $root = HTML::Zoom | |
->from_html(<<MAIN); | |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | |
<head> | |
<title>My Page Title</title> | |
</head> | |
<body> | |
<div id="sidebar">Test Sidebar</div> | |
<div id="content"> | |
<span id="p1">test label</span> | |
</div> | |
</body> | |
</html> | |
MAIN | |
my $label_html = HTML::Zoom | |
->from_html(<<LABEL); | |
<div id="stuff">Stuff</div> | |
LABEL | |
use Data::Dump 'dump'; | |
warn $root | |
->select('#p1') | |
->replace_content($label_html) | |
->select('#stuff') | |
->replace_content('Double Stuffed') | |
->to_html; | |
my $selected = HTML::Zoom->new; | |
$root | |
->select('#p1') | |
->collect_content({into=>sub {}}) | |
->run; | |
warn dump $selected; | |
warn $root->select('#p1'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment