Re: [perl-win32-gui] Log file reader

2000-10-31 Thread Aldo Calpini

Adam W. Klaum wrote:
 [...]
 The only thing I'm having a problem with is when I click the
 button to start or stop the service I end up using a while
 loop for the tail. The execution of the tail while loop locks
 the window object in place and you can't minimize or move
 the window or click anything while the tail is running.
 I mentioned something like this earlier in the list but had
 no code to show at the time.

you can use $Window-DoEvents() inside the loop to process
pending events. it will probably not be instantly responsive,
but better than nothing :-)

 Someone replied stating that I could use the Timer function
 to divorce the tail process from the window operations.
 I have looked at the Timer documentation and can't seem to
 figure out how it would help in this situation.  Any insight
 or alternate suggestions would be great.

basically, you go like this: in the Daemon(Start|Stop)_Click
events setup a Timer object like this:

if(defined $Timer) {
$Timer-SetInterval( 1000 );
} else {
$Timer = $Window-AddTimer( "Working", 1000 );
}

the 1000s stand for 1 second interval, you can change this
to your like (is in milliseconds).

then write a Working_Timer sub that does what you do in the
loop (without the loop of course, it gets already called once
per second by the Timer itself). when you reach your final
condition, put this to disable the timer:

$Timer-Kill();

of course, you should add extra code here and there to
Disable buttons while the Timer it's running and re-enable
them when it has finished.

I hope this makes some sense ;-)

 I have included the code but the services are
 proprietary so you all won't get to see it actually working
 :-(.  You should be able to run it and see the layout though
 (and the pretty start and stop buttons I made).  The whole
 tail mess begins at the DaemonStart_Click subroutine.

way cool buttons :-)


cheers,
Aldo

__END__
$_=q,just perl,,s, , another ,,s,$, hacker,,print;






[perl-win32-gui] Log file reader

2000-10-29 Thread Adam W. Klaum

I am writing a program that will allow the starting and stopping of product
specific services and will simultaneously tail a log file and put the
contents in a richtext object.  I am using the Win32::Service and File::Tail
modules as well as Win32::GUI.  It is working out pretty well.  I was even
able to color code some key parts of the log tail so that errors show up
nicely in red etc. etc.  The only thing I'm having a problem with is when I
click the button to start or stop the service I end up using a while loop
for the tail.  The execution of the tail while loop locks the window object
in place and you can't minimize or move the window or click anything while
the tail is running.  I mentioned something like this earlier in the list
but had no code to show at the time.  Someone replied stating that I could
use the Timer function to divorce the tail process from the window
operations.  I have looked at the Timer documentation and can't seem to
figure out how it would help in this situation.  Any insight or alternate
suggestions would be great.  I have included the code but the services are
proprietary so you all won't get to see it actually working :-(.  You should
be able to run it and see the layout though (and the pretty start and stop
buttons I made).  The whole tail mess begins at the DaemonStart_Click
subroutine.

Adam W. Klaum

P.S.  I present myself as the eternal student and welcome any and all
criticism/suggestions to my code.  In other words,  if you see something
stupid feel free to tell me about it.

 logrdr.zip