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~54^2~746 X-Git-Url: http://jsfdemo.indexdata.com/cgi-bin?a=commitdiff_plain;h=4ffb66ee679452a41a4bba0537528becf0c0f131;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;