source: for-distributions/trunk/bin/windows/perl/lib/XML/Parser/Style/Debug.pm@ 14489

Last change on this file since 14489 was 14489, checked in by oranfry, 17 years ago

upgrading to perl 5.8

File size: 982 bytes
Line 
1# $Id: Debug.pm,v 1.1 2003/07/27 16:07:49 matt Exp $
2
3package XML::Parser::Style::Debug;
4use strict;
5
6sub Start {
7 my $expat = shift;
8 my $tag = shift;
9 print STDERR "@{$expat->{Context}} \\\\ (@_)\n";
10}
11
12sub End {
13 my $expat = shift;
14 my $tag = shift;
15 print STDERR "@{$expat->{Context}} //\n";
16}
17
18sub Char {
19 my $expat = shift;
20 my $text = shift;
21 $text =~ s/([\x80-\xff])/sprintf "#x%X;", ord $1/eg;
22 $text =~ s/([\t\n])/sprintf "#%d;", ord $1/eg;
23 print STDERR "@{$expat->{Context}} || $text\n";
24}
25
26sub Proc {
27 my $expat = shift;
28 my $target = shift;
29 my $text = shift;
30 my @foo = @{$expat->{Context}};
31 print STDERR "@foo $target($text)\n";
32}
33
341;
35__END__
36
37=head1 NAME
38
39XML::Parser::Style::Debug - Debug style for XML::Parser
40
41=head1 SYNOPSIS
42
43 use XML::Parser;
44 my $p = XML::Parser->new(Style => 'Debug');
45 $p->parsefile('foo.xml');
46
47=head1 DESCRIPTION
48
49This just prints out the document in outline form to STDERR. Nothing special is
50returned by parse.
51
52=cut
Note: See TracBrowser for help on using the repository browser.