Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

Re^4: XML::Twig and threads

by grizzley (Chaplain)
on Nov 28, 2012 at 09:57 UTC ( #1005996=note: print w/replies, xml ) Need Help??

in reply to Re^3: XML::Twig and threads
in thread XML::Twig and threads [solved]

I won't bet obviousness :)

I've updated question node with example XML and script doing the job. Input file is read again in each of few hundred iterations. I was thinking about reading it once and then make in-memory copy in each iteration, but this will include swap on HDD and definitely won't speed up the code. Another way would be to store all changes write altered version to file, undo stored changes etc. That would save copying, but on the other hand as there are many changes - structure storing changes might be of same size as original. The best would be to somehow write to file original structure line after line and replace fragments on-fly.

Replies are listed 'Best First'.
Re^5: XML::Twig and threads
by BrowserUk (Pope) on Nov 28, 2012 at 13:44 UTC

    Firstly, updating the root node with new code is a bad idea. Very few if any people will re-read old nodes, so it will never be seen except by those you notify.

    Second, posting code that doesn't use strict & warnings and contains trivial errors that those would catch:

    Use of uninitialized value $fields[2] in pattern match (m//) at C:\tes +t\ line 56. Use of uninitialized value $fields[3] in pattern match (m//) at C:\tes +t\ line 64.

    will stop most people (including me) from looking further.

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    RIP Neil Armstrong

      Ok, noted. I just didn't want to start new discussion on the same topic.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1005996]
[LanX]: the bets are rather who will leave office first Trump or May
[erix]: Harakiri with a nuke on the white house, that'd clean up the staff there a bit too ;)
[erix]: (sorry, I'm always a bit violent on fridays)
LanX predicts problems for Erix next time he lines up at an US immigration counter
[erix]: but tuesdays just as bad

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (11)
As of 2017-08-18 13:14 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (302 votes). Check out past polls.