Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Moving elements with XML::Twig: Document root closing tag is duplicated on output -- solution

by Tanktalus (Canon)
on Feb 21, 2016 at 03:54 UTC ( [id://1155743]=note: print w/replies, xml ) Need Help??


in reply to Re: Moving elements with XML::Twig: Document root closing tag is duplicated on output -- solution
in thread [SOLVED] Moving elements with XML::Twig: Document root closing tag is duplicated on output

There's nothing wrong with '/shipment/box' => sub { _move(@_); 1; }. This is perfectly valid code. It means, call _move with all my parameters, but always return 1 - and this is all wrapped up with a code reference (it's an anonymous, or unnamed, sub). That return code, if you read the XML::Twig documentation, is relevant: "If a handler returns a true value and other handlers apply, then the next applicable handler will be called." I'm not sure what other handler there is, but there may be something trying to flush again here that I'm not seeing. When you change the return value, you may be changing the calling of this other handler, and that may stop the flushing. However, since handlers are documented to have meaningful return codes, it's probably best if you provide said meaningful return code.

  • Comment on Re^2: Moving elements with XML::Twig: Document root closing tag is duplicated on output -- solution
  • Download Code

Replies are listed 'Best First'.
Re^3: Moving elements with XML::Twig: Document root closing tag is duplicated on output -- solution
by Discipulus (Canon) on Feb 21, 2016 at 18:29 UTC
    thanks Tanktalus to have taken the time to clarify this matter to me.

    Anyway maybe mirod can explain the details. You know (or well maybe not..) that my Perl knoweledge is a little.. empyric and if by one hand i tend to try many times unusefull and dangerous things with Perl, by other hand i tend to play gently when using modules, trying to keep me more close that i can to what the module's docs say. Because i ignore what XML::Twig does under the wood. Someone can learn Perl, no one CPAN (at least not me).

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1155743]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2024-04-19 12:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found