From 4ffb66ee679452a41a4bba0537528becf0c0f131 Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Tue, 14 Nov 2006 16:21:49 +0000 Subject: [PATCH 1/1] Xml_encode() accepts fallback string. --- lib/ZOOM/IRSpy/Utils.pm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm index adbb75a..b88ec1a 100644 --- a/lib/ZOOM/IRSpy/Utils.pm +++ b/lib/ZOOM/IRSpy/Utils.pm @@ -1,4 +1,4 @@ -# $Id: Utils.pm,v 1.13 2006-11-14 16:04:36 mike Exp $ +# $Id: Utils.pm,v 1.14 2006-11-14 16:21:49 mike Exp $ package ZOOM::IRSpy::Utils; @@ -26,7 +26,13 @@ our $IRSPY_NS = 'http://indexdata.com/irspy/1.0'; # Template::Plugin both roll their own. So I will do likewise. D'oh! # sub xml_encode { - my ($text) = @_; + my ($text, $fallback) = @_; + + $text = $fallback if !defined $text; + use Carp; + confess "xml_encode(): text and fallback both undefined" + if !defined $text; + $text =~ s/&/&/g; $text =~ s//>/g; -- 1.7.10.4