XML-LibXML-jQuery
view release on metacpan or search on metacpan
#!/usr/bin/env perl
use strict;
use warnings;
use lib 'lib';
use Test::More;
use XML::LibXML::jQuery;
sub test(&@);
my $html = '<div class="container"><h2>Greetings</h2><div class="inner">Hello</div><div class="inner">Goodbye</div></div>';
# before(html)
test { $_->find('h2, .inner')->before('<p/>') } 'before(html)';
test { $_->find('h2, .inner')->before(j('<p/>')) } 'before(jQuery)';
test {
my $p = $_->new('<p/>')->append_to($_);
( run in 0.526 second using v1.01-cache-2.11-cpan-49f99fa48dc )