Reloading perl file dynamically
- From: "req" <reqvidd@xxxxxxxxx>
- Date: 31 Mar 2006 01:50:30 -0800
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
.
- Follow-Ups:
- Re: Reloading perl file dynamically
- From: Mintcake
- Re: Reloading perl file dynamically
- From: Anno Siegel
- Re: Reloading perl file dynamically
- Prev by Date: Re: Find duplicates in a dat file
- Next by Date: Re: Reloading perl file dynamically
- Previous by thread: win32 reading wide filenames (unicode)
- Next by thread: Re: Reloading perl file dynamically
- Index(es):
Relevant Pages
|