Re: Reloading perl file dynamically
- From: anno4000@xxxxxxxxxxxxxxxxxxxxxxx (Anno Siegel)
- Date: 31 Mar 2006 11:32:54 GMT
req <reqvidd@xxxxxxxxx> wrote in comp.lang.perl.misc:
So what is the specific loop that gives you trouble? We can't
debug code we don't see. Reduce the problem to a small program
that we can run and post that. Unless you find the problem in
the process, that is.
I see your point of course, but right now I can't break it down for you
in that way (lacking time). For the time being I would be really happy
for suggestsions on how to attack the original general problem - that
is, to load something into memory and from the same script that did
this, call another script that may change dynamically. I don't know the
best way to achieve this.
It's what Module::Reload is supposed to do, and it works fine for me
(see below). Apparently your situation is more involved, but before
we know in which way, fishing for alternatives is just guesswork.
Anno
--- main program ---
#!/usr/bin/perl
use strict; use warnings; $| = 1;
use Module::Reload;
use MyLib; # where run_tests() is defined
while ( 1 ) {
MyLib::run_tests();
sleep 1 until Module::Reload->check;
}
__END__
--- File MyLib.pl ---
package MyLib;
use strict; use warnings;
my $str = "boo";
no warnings 'redefine';
sub run_tests { print "$str\n" }
1;
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
.
- References:
- Reloading perl file dynamically
- From: req
- Re: Reloading perl file dynamically
- From: Anno Siegel
- Re: Reloading perl file dynamically
- From: req
- Reloading perl file dynamically
- Prev by Date: Re: Converting codepages to UTF8
- Next by Date: Re: Converting codepages to UTF8
- Previous by thread: Re: Reloading perl file dynamically
- Next by thread: Re: Reloading perl file dynamically
- Index(es):
Relevant Pages
|
|