hello monks,

I'm running on the shaggy way of XML processing and I choose my tool: XML::Twig (thanks mirod!).

I'm experiencing a problem with the parsefile_inplace method described here. I have a simple program:
#!/bin/perl -w use strict; use XML::Twig; my $file = 'orders.xml' ; my $ext = '.'.time; my $twig = XML::Twig->new(pretty_print => 'indented'); #$twig->parsefile( $file) or die "could not parse!"; $twig->parsefile_inplace ( $file, $ext) ; $twig->print();
..and a simple XML file:
<?xml version="1.0"?> <Order> <Date>2003/07/04</Date> <CustomerId>123</CustomerId> <CustomerName>Acme Alpha</CustomerName> <Item> <ItemId> 987</ItemId> <ItemName>Coupler</ItemName> <Quantity>5</Quantity> </Item> <Item> <ItemId>654</ItemId> <ItemName>Connector</ItemName> <Quantity unit="12">3</Quantity> </Item> <Item> <ItemId>579</ItemId> <ItemName>Clasp</ItemName> <Quantity>1</Quantity> </Item> </Order>
but when i run this the XML is printed to STDOUT (it is not selected the FH to the output file?) and i find myself with an empty orders.xml file and a correct sized orders.xml.1374219815 file.

I use strawberry Perl 5.16 on win7 64bit and I can safely run perl -e "use File::Temp"

Many thanks for the attention

L*
there are no rules, there are no thumbs..

In reply to XML::Twig parsefile_inplace misunderstanding by Discipulus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.