[LA.pm] app_running status...and the answer is!

David Heayn davidmailinglist at cloudgraphics.com
Mon Nov 6 06:33:00 PST 2006


>
>A comprehensive overview (a brief one as perl completely documents
>these methods) was, imo, called for, without giving away the
>entire algorithm, in order for the poster to have some work
>to do themselves.

Rightly so. I almost gave up on my own thread because I was looking 
for a subject line as I've posted. I know the perl people tend to be 
more guru than the raging C# or javascript crowd and there's always 
insight here. (I apologize for the delay, I was away on business.)

I'm clutching my knuckles as if they can't be bloodied. A few books 
gave me some insight into my horrendous assumption. Many thanks to 
the camel book, and the little camel book.


Filehandles worked


open(COMMAND, "ps -U user |") or die "Can't run program: $!\n";
while(<COMMAND>) {
     $shell_output .= $_;
}
close(COMMAND);

	unless ($shell_output =~ /firefox/)
[snip]


I got ridiculous and thought perl would handle arrogance.




>As far the most optimal solution, do it in C where there are
>OS library functions one can call, instead of invoking perl's
>ability to invoke outside processes, which would cut the CPU
>cycles in half for the task.

I'm not really there yet. The final script checks if firefox is 
running, does a quick cookie file edit, then exits. I realize there 
is a cookie manager in ff. However, I need any and all web sites to 
set cookies while browsing (to prevent manual intervention). A daily 
and nightly cleanup then happens, only if ff isn't in use.

I learned some important concepts.

David Heayn * http://www.cloudgraphics.com * (213)925.3283


More information about the Losangeles-pm mailing list