projects
/
irspy-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
1f230ac
)
Xml_encode() accepts fallback string.
author
Mike Taylor
<mike@indexdata.com>
Tue, 14 Nov 2006 16:21:49 +0000
(16:21 +0000)
committer
Mike Taylor
<mike@indexdata.com>
Tue, 14 Nov 2006 16:21:49 +0000
(16:21 +0000)
lib/ZOOM/IRSpy/Utils.pm
patch
|
blob
|
history
diff --git
a/lib/ZOOM/IRSpy/Utils.pm
b/lib/ZOOM/IRSpy/Utils.pm
index
adbb75a
..
b88ec1a
100644
(file)
--- 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;
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 {
# 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;
$text =~ s/>/>/g;
$text =~ s/&/&/g;
$text =~ s/</</g;
$text =~ s/>/>/g;