Reloading perl file dynamically



Hi,

First of all, here's my problem:

I have to parse a huge XML file and then run several tests on it.
The loading can take several minutes, and the tests I run I change all
the time.
So what I want to do is to keep the parsed XML in memory, and then keep
the tests in a separate file that I reload every time I have changed
any tests. Then the XML parsing is only done once for a set of tests.

I thought I could achieve this with Module::Reload, but I doesn't work
for me. It reloads the file if it has changed on disk, but I can't see
that the code changes gets reflected...
So I resigned to "do FILE". This works, BUT

Scary stuff happens. I have done quite some debugging and I can't
understand what is going on. Every second time I run the tests (on the
previously parsed XML) a specific "while-loop" over a regexp is not
matching. And it's clear what is supposed to match is really there. So
I run the tests again, and suddenly it works. And the next time not,
and so on. It's really spooky.

I don't feel comfortable with the do FILE since the file I'm loading is
quite complex, calling stuff in the "main" program as well, but it
seems to work flawlessly on the FIRST run.

Any hints, or a differnet approach maybe? Are the Reload really meant
to work for me in this type of situation - to really reload the module
and see all new code and apply it?

Greatful for any tips!

/D

.



Relevant Pages

  • RE: Root element is missing
    ... How to reload the project. ... The csroj file is in xml ... format and the error indicates the xml is invalid (root node is missing or ...
    (microsoft.public.dotnet.framework)
  • Re: Memory Tables
    ... > reload the table in the morning. ... XML file with schema. ... record editor to modify the data in the XML ... The loader could then reload the XML data to the "binary record format ...
    (comp.unix.programmer)
  • Re: gridview clear & refresh
    ... I'm loading the grid view from a xml that can be edited or added to then saved back. ... I think I need to clear then reload the grid to reflect edits saved back to the xml file. ... Private Sub btnReadXML_ClickHandles btnReadXML.Click ...
    (microsoft.public.dotnet.languages.vb)
  • Re: gridview clear & refresh
    ... I'm loading the grid view from a xml that can be edited or added to then saved back. ... I think I need to clear then reload the grid to reflect edits saved back to the xml file. ... Oh, one other thing, you can execute the GetAirportsand bind it to the Datasource right after the Refresh if you like too. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Reloading perl file dynamically
    ... I have to parse a huge XML file and then run several tests on it. ... the tests in a separate file that I reload every time I have changed ... that the code changes gets reflected... ... "Reply" at the bottom of the article headers. ...
    (comp.lang.perl.misc)