From: Matt S Trout Date: Thu, 10 Feb 2011 18:17:01 +0000 (+0000) Subject: avoid undef errors blowing out XML::Tags X-Git-Tag: release_0.006~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FWeb-Simple.git;a=commitdiff_plain;h=ce446593a2c969d2567a9d9dddacc031ffd7d292 avoid undef errors blowing out XML::Tags --- diff --git a/lib/XML/Tags.pm b/lib/XML/Tags.pm index 9249691..8b30b60 100644 --- a/lib/XML/Tags.pm +++ b/lib/XML/Tags.pm @@ -26,7 +26,11 @@ sub to_xml_string { ref($_) ? (ref $_ eq 'SCALAR' ? $$_ : $_) : do { local $_ = $_; # copy - s/&/&/g; s/"/"/g; s//>/g; $_; + if (defined) { + s/&/&/g; s/"/"/g; s//>/g; $_; + } else { + '' + } } } @_ }