source: main/trunk/release-kits/shared/linux/XML-Parser/perl-5.10/XML/Parser/Style/Subs.pm@ 22416

Last change on this file since 22416 was 22416, checked in by ak19, 14 years ago

Added the perl 5.10 XML-Parser to the versions that are included with Greenstone releases

File size: 1.1 KB
Line 
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.