/usr/share/perl5/MKDoc/XML/Encode.pm is in libmkdoc-xml-perl 0.75-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | # -------------------------------------------------------------------------------------
# MKDoc::XML::Encode
# -------------------------------------------------------------------------------------
# Author : Jean-Michel Hiver.
# Copyright : (c) MKDoc Holdings Ltd, 2003
#
# This modules encodes XML entities & > < " and '.
#
# This module is distributed under the same license as Perl itself.
# -------------------------------------------------------------------------------------
package MKDoc::XML::Encode;
use warnings;
use strict;
our %XML_Encode = (
'&' => 'amp',
'<' => 'lt',
'>' => 'gt',
'"' => 'quot',
"'" => 'apos',
);
our $XML_Encode_Pattern = join ("|", keys %XML_Encode);
sub process
{
(@_ == 2) or warn "MKDoc::XML::Encode::process() should be called with two arguments";
my $class = shift;
my $data = join '', map { (defined $_) ? $_ : '' } @_;
$data =~ s/($XML_Encode_Pattern)/&$XML_Encode{$1};/go;
return $data;
}
1;
__END__
=head1 NAME
MKDoc::XML::Encode - Encodes XML entities
=head1 SYNOPSIS
use MKDoc::XML::Encode;
# $xml is now "Chris' Baloon"
my $xml = MKDoc::XML::Encode->process ("Chris' Baloon");
=head1 SUMMARY
MKDoc::XML::Encode is a very simple module which encodes the following entities.
'
"
>
<
&
That's it.
This module and its counterpart L<MKDoc::XML::Decode> are used by L<MKDoc::XML::Dumper>
to XML-encode and XML-decode litterals.
=head1 API
=head2 my $xml_encoded = MKDoc::XML::Encode->process ($some_string);
Does what is said in the summary.
=head1 AUTHOR
Copyright 2003 - MKDoc Holdings Ltd.
Author: Jean-Michel Hiver
This module is free software and is distributed under the same license as Perl
itself. Use it at your own risk.
=head1 SEE ALSO
L<MKDoc::XML::DecodeHO>
L<MKDoc::XML::Encode>
=cut
|