/usr/share/perl5/XML/SAX/RPMRepomdHandler.pm is in argonaut-common 0.9.2-1.
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 | #######################################################################
#
# XML::SAX::RPMRepomdHandler -- get and parse RPM Packages.
#
# Copyright (C) 2015 FusionDirectory project
#
# Author: Côme BERNIGAUD
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
#
#######################################################################
package XML::SAX::RPMRepomdHandler;
use base qw(XML::SAX::Base);
sub new {
my $class = shift;
$self = {
'type' => shift || 'primary',
};
return bless $self, $class;
}
sub start_document {
my ($self, $doc) = @_;
$self->{waiting} = 0;
$self->{result} = undef;
}
sub start_element {
my ($self, $el) = @_;
if (($self->{waiting} == 0) && ($el->{LocalName} eq 'data') && ($el->{Attributes}->{'{}type'}->{'Value'} eq $self->{type})) {
$self->{waiting} = 1;
$self->{key} = undef;
} elsif (($self->{waiting} == 1) && ($el->{LocalName} eq 'location')) {
$self->{waiting}++;
$self->{result} = $el->{Attributes}->{'{}href'}->{'Value'};
}
}
1;
=pod
Example:
use LWP::Simple;
use XML::SAX;
use XML::SAX::RPMRepomdHandler;
my $uri = 'http://mirror.centos.org/centos/6/os/x86_64/repodata/';
my $dir = '/tmp/';
my $res = mirror($uri."repomd.xml" => $dir."repomd.xml");
if (is_error($res)) {
die 'Could not download '.$uri.'repomd.xml: '.$res;
}
my $parser = XML::SAX::ParserFactory->parser(
Handler => XML::SAX::RPMRepomdHandler->new()
);
$parser->parse_uri($dir."repomd.xml");
print $parser->{Handler}->{result};
=cut
|