This file is indexed.

/usr/share/perl5/XML/PatAct/MatchName.pm is in libxml-perl 0.08-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
99
#
# Copyright (C) 1999 Ken MacLeod
# XML::PatAct::MatchName is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# $Id: MatchName.pm,v 1.3 1999/12/22 21:15:00 kmacleod Exp $
#

use strict;

package XML::PatAct::MatchName;

use vars qw{ $VERSION };

# will be substituted by make-rel script
$VERSION = "0.08";

sub new {
    my $type = shift;
    my $self = ($#_ == 0) ? { %{ (shift) } } : { @_ };

    return bless $self, $type;
}

# This is functionally equivalent to PerlSAX `start_document()'
sub initialize {
    my ($self, $driver) = @_;
    $self->{Driver} = $driver;
}

# This is functionally equivalent to PerlSAX `end_document()'
sub finalize {
    my $self = shift;

    $self->{Driver} = undef;
}

# This is functionally equivalent to a PerlSAX `start_element()'
sub match {
    my ($self, $element, $names, $nodes) = @_;

    my $names_path = '/' . join('/', @$names);
    my $patterns = $self->{Patterns};
    my $ii = 0;
    while ($ii <= $#$patterns) {
        my $pattern = $patterns->[$ii];
	if ($names_path =~ m|/$pattern$|) {
	    return $ii / 2;
	}
	$ii += 2;
    }

    return undef;
}

1;

__END__

=head1 NAME

XML::PatAct::MatchName - A pattern module for matching element names

=head1 SYNOPSIS

 use XML::PatAct::MatchName;

 my $matcher = XML::PatAct::MatchName->new();

 my $patterns = [ 'foo' => ACTION,
		  'bar/foo' => ACTION,
		  ... ];

=head1 DESCRIPTION

XML::PatAct::MatchName is a pattern module for use with PatAct drivers
for applying pattern-action lists to XML parses or trees.
XML::PatAct::MatchName is a simple pattern module that uses just
element names to match on.  If multiple names are supplied separated
by `C</>' characters, then all of the parent element names must match
as well.

The order of patterns in the list is not significant.
XML::PatAct::MatchName will use the most specific match.  Using the
synopsis above as an example, if you have an element `C<foo>',
`C<bar/foo>' will match if `C<foo>' is in an element `C<bar>',
otherwise just the pattern with `C<foo>' will match.

=head1 AUTHOR

Ken MacLeod, ken@bitsko.slc.ut.us

=head1 SEE ALSO

perl(1)

``Using PatAct Modules'' and ``Creating PatAct Modules'' in libxml-perl.

=cut