From 63007e38f0bdac71e72ac6e7eb4c07169d2a2bf7 Mon Sep 17 00:00:00 2001
From: Terrence Brannon <TBrannon@SmartFinancial.com>
Date: Tue, 17 Mar 2009 08:39:48 -0400
Subject: [PATCH] optionally return tree

---
 lib/HTML/Element/Library.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/HTML/Element/Library.pm b/lib/HTML/Element/Library.pm
index bc85c9d..4c2d879 100644
--- a/lib/HTML/Element/Library.pm
+++ b/lib/HTML/Element/Library.pm
@@ -34,7 +34,7 @@ our $VERSION = '3.53';
 # https://rt.cpan.org/Ticket/Display.html?id=44105
 sub HTML::Element::fillinform {
 
-    my ($tree, $hashref)=@_;
+    my ($tree, $hashref, $return_tree)=@_;
 
     (ref $hashref) eq 'HASH' or die 'hashref not supplied as argument' ;
 
@@ -42,6 +42,12 @@ sub HTML::Element::fillinform {
     my $html = $tree->as_HTML;
     my $new_html = HTML::FillInForm->fill(\$html, $hashref);
 
+    if ($return_tree) {
+	HTML::TreeBuilder->new_from_content($new_html);
+    } else {
+	$new_html;
+    }
+
 }
 
 sub HTML::Element::siblings {
-- 
2.39.5