| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package XML::Mini; | 
| 2 | 10 |  |  | 10 |  | 11709 | use strict; | 
|  | 10 |  |  |  |  | 23 |  | 
|  | 10 |  |  |  |  | 580 |  | 
| 3 |  |  |  |  |  |  | $^W = 1; | 
| 4 |  |  |  |  |  |  |  | 
| 5 | 10 |  |  |  |  | 5841 | use vars qw ( | 
| 6 |  |  |  |  |  |  | $AutoEscapeEntities | 
| 7 |  |  |  |  |  |  | $AutoSetParent | 
| 8 |  |  |  |  |  |  | $AvoidLoops | 
| 9 |  |  |  |  |  |  | $CaseSensitive | 
| 10 |  |  |  |  |  |  | $Debug | 
| 11 |  |  |  |  |  |  | $IgnoreWhitespaces | 
| 12 |  |  |  |  |  |  | $NoWhiteSpaces | 
| 13 |  |  |  |  |  |  | $CheckXMLBeforeParsing | 
| 14 |  |  |  |  |  |  | $DieOnBadXML | 
| 15 |  |  |  |  |  |  | $VERSION | 
| 16 |  |  |  |  |  |  | $IgnoreDeepRecursionWarnings | 
| 17 | 10 |  |  | 10 |  | 54 | ); | 
|  | 10 |  |  |  |  | 21 |  | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | $VERSION = '1.38'; | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | $AvoidLoops = 0; | 
| 22 |  |  |  |  |  |  | $AutoEscapeEntities = 1; | 
| 23 |  |  |  |  |  |  | $Debug = 0; | 
| 24 |  |  |  |  |  |  | $IgnoreWhitespaces = 1; | 
| 25 |  |  |  |  |  |  | $CaseSensitive = 0; | 
| 26 |  |  |  |  |  |  | $AutoSetParent = 0; | 
| 27 |  |  |  |  |  |  | $NoWhiteSpaces = -999; | 
| 28 |  |  |  |  |  |  | $CheckXMLBeforeParsing = 1; | 
| 29 |  |  |  |  |  |  | $DieOnBadXML = 1; | 
| 30 |  |  |  |  |  |  |  | 
| 31 |  |  |  |  |  |  | $IgnoreDeepRecursionWarnings = 1; | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub Log | 
| 34 |  |  |  |  |  |  | { | 
| 35 | 1 |  |  | 1 | 1 | 3 | my $class = shift; | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 1 |  |  |  |  | 89 | print STDERR "XML::Mini LOG MESSAGE:" ; | 
| 38 | 1 |  |  |  |  | 67 | print STDERR join(" ", @_) . "\n"; | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | sub Error | 
| 42 |  |  |  |  |  |  | { | 
| 43 | 0 |  |  | 0 | 1 | 0 | my $class = shift; | 
| 44 |  |  |  |  |  |  |  | 
| 45 | 0 |  |  |  |  | 0 | my $errMsg =  "XML::Mini Error MESSAGE:" . join(" ", @_) . "\n"; | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 0 |  |  |  |  | 0 | print STDERR $errMsg; | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 |  |  |  |  | 0 | die $errMsg; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub escapeEntities | 
| 53 |  |  |  |  |  |  | { | 
| 54 | 592 |  |  | 592 | 0 | 728 | my $class = shift; | 
| 55 | 592 |  |  |  |  | 707 | my $toencode = shift; | 
| 56 |  |  |  |  |  |  |  | 
| 57 | 592 | 50 |  |  |  | 1120 | return undef unless (defined $toencode); | 
| 58 |  |  |  |  |  |  |  | 
| 59 | 592 |  |  |  |  | 980 | $toencode=~s/&/&/g; | 
| 60 | 592 |  |  |  |  | 660 | $toencode=~s/\"/"/g; | 
| 61 | 592 |  |  |  |  | 699 | $toencode=~s/>/>/g; | 
| 62 | 592 |  |  |  |  | 652 | $toencode=~s/</g; | 
| 63 | 592 |  |  |  |  | 887 | $toencode=~s/([\xA0-\xFF])/"".ord($1).";"/ge; | 
|  | 0 |  |  |  |  | 0 |  | 
| 64 | 592 |  |  |  |  | 1778 | return $toencode; | 
| 65 |  |  |  |  |  |  | } | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | sub ignoreDeepRecursionWarning { | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | # we do deep recursion... but it's ok, stop warning... | 
| 70 |  |  |  |  |  |  | $SIG{__WARN__} = sub { | 
| 71 | 20 |  |  | 20 |  | 314649 | my $msg = shift; | 
| 72 | 20 | 50 |  |  |  | 244 | print STDERR $msg if ($msg !~ /Deep recursion/); | 
| 73 | 10 |  |  | 10 | 1 | 136 | }; | 
| 74 |  |  |  |  |  |  | } | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  | 1; | 
| 79 |  |  |  |  |  |  | __END__ |