/usr/share/perl5/XML/Smart/Entity.pm is in libxml-smart-perl 1.78-2.
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 | #############################################################################
## Name: Entity.pm
## Purpose: XML::Smart::Entity - Handle entities
## Author: Graciliano M. P.
## Modified by: Harish Madabushi
## 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 ;
use strict ;
use warnings ;
require Exporter ;
use XML::Smart::Shared qw( _unset_sig_warn _reset_sig_warn ) ;
our ($VERSION , @ISA) ;
$VERSION = '0.03' ;
@ISA = qw(Exporter) ;
our @EXPORT = qw(_parse_basic_entity _add_basic_entity) ;
our @EXPORT_OK = @EXPORT ;
#######################
# _PARSE_BASIC_ENTITY #
#######################
sub _parse_basic_entity {
my $entity = $_[0] ;
if( $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( $entity ) ;
}
#####################
# _ADD_BASIC_ENTITY #
#####################
sub _add_basic_entity {
my $entity = $_[0] ;
if( $entity ) {
$_[0] =~ s/(&(?:\w+;)?)/{_is_amp($1) or $1}/sgex ;
$_[0] =~ s/</</gs ;
$_[0] =~ s/>/>/gs ;
}
return( $entity ) ;
}
###########
# _IS_AMP #
###########
sub _is_amp {
my $entity = $_[0] ;
if( $entity ) {
if($entity eq '&') {
return( '&' ) ;
}
}
return( undef ) ;
}
#######
# END #
#######
1;
|