Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Do not reinvent the wheel: real-world example using XML::Twig

by ambrus (Abbot)
on Jun 05, 2005 at 09:15 UTC ( #463681=perlmeditation: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use warnings;
    use strict;
    ...
                                                                          
    +          
    {
                                                                          
    +          
    
  2. or download this
    # REIMPLEMENTING THE WHEEL STARTS HERE
    
    ...
            $handler{"Char"} = sub { $string .= $_[1]; };
                                                                          
    +          
    # REIMPLEMENTING THE WHEEL ENDS HERE (more or less)
    
  3. or download this
            my($child, $member, $goodness, $id);
            $starthandler{"cluster"} = sub {
    ...
                    sub { push @$member, $string; };
            };
                                                                          
    +          
    
  4. or download this
            XML::Parser->new("Handlers", \%handler)->parsefile($ARGV[0]);
    
  5. or download this
            warn "done parsing xml";
                                                                          
    +          
    ...
                                                                          
    +          
    # ... and here we actually do something with what we'we read, but I wo
    +n't show that ...
    
  6. or download this
    use warnings;
    use strict;
    ...
                                                                          
    +          
    # ... and I omit the rest of the code again ...
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://463681]
Approved by bart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-11-24 00:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (134 votes), past polls