/usr/share/perl5/XML/Handler/PrintEvents.pm is in libxml-handler-printevents-perl 0.01-7.
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 | #
# This PerlSAX handler prints out all the PerlSAX events/callbacks
# it receives. Very useful when debugging.
#
package XML::Handler::PrintEvents;
use strict;
use XML::Filter::SAXT;
use vars qw($VERSION);
$VERSION = 0.01;
my @EXTRA_HANDLERS = ( 'ignorable_whitespace' );
sub new
{
my ($class, %options) = @_;
bless \%options, $class;
}
sub print_event
{
my ($self, $event_name, $event) = @_;
printf "%-22s ", $event_name;
if (defined $event)
{
print join (", ", map { "$_ => [" .
(defined $event->{$_} ? $event->{$_} : "(undef)")
. "]" } keys %$event);
}
print "\n";
}
#
# This generates the PerlSAX handler methods for PrintEvents.
# They basically forward the event to print_event() while adding the callback
# (event) name.
#
for my $cb (@EXTRA_HANDLERS, map { @{$_} } values %XML::Filter::SAXT::SAX_HANDLERS)
{
eval "sub $cb { shift->print_event ('$cb', \@_) }";
}
1; # package return code
__END__
=head1 NAME
XML::Handler::PrintEvents - Prints PerlSAX events (for debugging)
=head1 SYNOPSIS
use XML::Handler::PrintEvents;
my $pr = new XML::Handler::PrintEvents;
=head1 DESCRIPTION
This PerlSAX handler prints the PerlSAX events it receives to STDOUT.
It can be useful when debugging PerlSAX filters.
It supports all PerlSAX handler including ignorable_whitespace.
=head1 AUTHOR
Enno Derksen is the original author.
Send bug reports, hints, tips, suggestions to T.J. Mather at
<F<tjmather@tjmather.com>>.
=cut
|