/usr/share/perl5/WebKDC/XmlDoc.pm is in libwebkdc-perl 4.1.1-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 91 92 93 94 95 96 97 98 | # Manipulate a document composed of WebKDC::XmlElement objects.
#
# Written by Roland Schemers
# Copyright 2002, 2009
# The Board of Trustees of the Leland Stanford Junior University
#
# See LICENSE for licensing terms.
package WebKDC::XmlDoc;
use strict;
use warnings;
use WebKDC::XmlElement;
BEGIN {
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
# set the version for version checking
$VERSION = 1.00;
@ISA = qw(Exporter);
@EXPORT = qw();
%EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
# your exported package globals go here,
# as well as any optionally exported functions
@EXPORT_OK = qw();
}
our @EXPORT_OK;
sub new {
my $type = shift;
my $self = {};
bless $self, $type;
return $self;
}
sub start {
my $self = shift;
my $name = shift;
my $element = new WebKDC::XmlElement;
$element->name($name);
if (@_) {
my $attrs = shift;
$element->attrs($attrs) if defined($attrs);
}
if (@_) {
$element->content(shift);
}
if (!defined($self->{'root'})) {
$self->{'root'} = $element;
} else {
my $s = $self->{'stack'};
my $parent = @{$s}[$#{$s}];
$parent->add_child($element);
}
push(@{$self->{'stack'}}, $element);
return $self;
}
sub current {
my $self = shift;
my $s = $self->{'stack'};
my $e = @{$s}[$#{$s}] || die "not in an element";
return $e;
}
sub end {
my $self = shift;
my $s = $self->{'stack'};
my $e = @{$s}[$#{$s}] || die "not in an element";
if (@_) {
my $name = shift;
my $aname = $e->name;
if ($name ne $aname) {
die "name mismatch in end. expecting($name), actual($aname)";
}
}
pop(@{$self->{'stack'}});
}
sub add {
my ($self, $name, $attrs, $text) = @_;
$self->start($name, $attrs);
$self->current->append_content($text) if defined($text);
$self->end;
}
sub root {
my $self = shift;
return $self->{'root'};
}
1;
__END__
|