source: main/trunk/release-kits/shared/linux/XML-Parser/64-bit/perl-5.22/XML/Parser/Style/Subs.pm@ 31809

Last change on this file since 31809 was 31809, checked in by ak19, 7 years ago

Added the XML-Parser for perl 5.22 as well for the release-kit to include in binaries. Note that, just as for the perl-5.24 version committed before, the auto/XML/Parser/Expat.bs (bootstrap file?) is copied from the perl 5.18 that was committed much longer ago, since the .bs file didn't differ between 5.10 and 5.18.

File size: 1.1 KB
RevLine 
[31809]1# $Id: Subs.pm,v 1.1 2003-07-27 16:07:49 matt Exp $
2
3package XML::Parser::Style::Subs;
4
5sub Start {
6 no strict 'refs';
7 my $expat = shift;
8 my $tag = shift;
9 my $sub = $expat->{Pkg} . "::$tag";
10 eval { &$sub($expat, $tag, @_) };
11}
12
13sub End {
14 no strict 'refs';
15 my $expat = shift;
16 my $tag = shift;
17 my $sub = $expat->{Pkg} . "::${tag}_";
18 eval { &$sub($expat, $tag) };
19}
20
211;
22__END__
23
24=head1 NAME
25
26XML::Parser::Style::Subs
27
28=head1 SYNOPSIS
29
30 use XML::Parser;
31 my $p = XML::Parser->new(Style => 'Subs', Pkg => 'MySubs');
32 $p->parsefile('foo.xml');
33
34 {
35 package MySubs;
36
37 sub foo {
38 # start of foo tag
39 }
40
41 sub foo_ {
42 # end of foo tag
43 }
44 }
45
46=head1 DESCRIPTION
47
48Each time an element starts, a sub by that name in the package specified
49by the Pkg option is called with the same parameters that the Start
50handler gets called with.
51
52Each time an element ends, a sub with that name appended with an underscore
53("_"), is called with the same parameters that the End handler gets called
54with.
55
56Nothing special is returned by parse.
57
58=cut
Note: See TracBrowser for help on using the repository browser.