From: Mike Taylor Date: Tue, 14 Nov 2006 16:21:49 +0000 (+0000) Subject: Xml_encode() accepts fallback string. X-Git-Tag: CPAN-v1.02~801 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=0c53d7bd99b7a02121a0727980d058fae6ffeb9a;p=irspy-moved-to-github.git Xml_encode() accepts fallback string. --- 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;