/usr/share/perl5/XML/Smart/Entity.pm is in libxml-smart-perl 1.6.9-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 | #############################################################################
## Name: Entity.pm
## Purpose: XML::Smart::Entity - Handle entities
## Author: Graciliano M. P.
## Modified by:
## Created: 28/09/2003
## RCS-ID:
## Copyright: (c) 2003 Graciliano M. P.
## Licence: This program is free software; you can redistribute it and/or
## modify it under the same terms as Perl itself
#############################################################################
package XML::Smart::Entity ;
our ($VERSION , @ISA) ;
$VERSION = '0.01' ;
require Exporter ;
@ISA = qw(Exporter) ;
our @EXPORT = qw(_parse_basic_entity _add_basic_entity) ;
our @EXPORT_OK = @EXPORT ;
use strict ;
no warnings ;
#######################
# _PARSE_BASIC_ENTITY #
#######################
sub _parse_basic_entity {
$_[0] =~ s/</</gs ;
$_[0] =~ s/>/>/gs ;
$_[0] =~ s/&/&/gs ;
$_[0] =~ s/'/'/gs ;
$_[0] =~ s/"/"/gs ;
$_[0] =~ s/&#(\d+);/ $1 > 255 ? pack("U",$1) : pack("C",$1)/egs ;
$_[0] =~ s/&#x([a-fA-F\d]+);/pack("U",hex($1))/egs ;
return( $_[0] ) ;
}
#####################
# _ADD_BASIC_ENTITY #
#####################
sub _add_basic_entity {
$_[0] =~ s/(&(?:\w+;)?)/{_is_amp($1) or $1}/sgex ;
$_[0] =~ s/</</gs ;
$_[0] =~ s/>/>/gs ;
return( $_[0] ) ;
}
###########
# _IS_AMP #
###########
sub _is_amp {
if ($_[0] eq '&') { return( '&' ) ;}
return( undef ) ;
}
#######
# END #
#######
1;
|