<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2723.2500" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Courier color=#0000ff size=2><SPAN class=138223218-12052003>This
sounds like a symptom of common problem - the scope of
filehandles. You might want to create a typeglob to use as a filehandle,
that way it gets garbage collected when it is out of scope.</SPAN></FONT></DIV>
<DIV><FONT face=Courier color=#0000ff size=2><SPAN
class=138223218-12052003></SPAN></FONT> </DIV>
<DIV><FONT face=Courier color=#0000ff size=2><SPAN class=138223218-12052003>For
examples:</SPAN></FONT></DIV>
<DIV><FONT face=Courier color=#0000ff size=2><SPAN class=138223218-12052003><A
href="http://www.perldoc.com/perl5.6/pod/perlfaq5.html#How-can-I-make-a-filehandle-local-to-a-subroutine---How-do-I-pass-filehandles-between-subroutines---How-do-I-make-an-array-of-filehandles">http://www.perldoc.com/perl5.6/pod/perlfaq5.html#How-can-I-make-a-filehandle-local-to-a-subroutine---How-do-I-pass-filehandles-between-subroutines---How-do-I-make-an-array-of-filehandles</A>-</SPAN></FONT></DIV>
<DIV><FONT face=Courier color=#0000ff size=2></FONT> </DIV>
<DIV><SPAN class=138223218-12052003><FONT face=Courier color=#0000ff size=2>I'm
not 100% sure this is your problem, but is definately a "best practices" thing
when dealing with an embedded interpreter (or highly recursive
functions).</FONT></SPAN></DIV>
<P><FONT face="Courier New" size=2>--</FONT> <BR><FONT face="Courier New"
size=2>"Computer science is as much about computers as</FONT> <BR><FONT
face="Courier New" size=2> astronomy
is about telescopes" -- Edsger Dijkstra</FONT> <BR><FONT face="Courier New"
size=2>---------------------------------------------------------</FONT>
<BR><FONT face="Courier New" size=2>Anthony Tonns, UNIX Administrator -
atonns@mail.ivillage.com</FONT> </P>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma
size=2>-----Original Message-----<BR><B>From:</B> Jan van den Berg
[mailto:j.vandenberg@cheesecrispies.com]<BR><B>Sent:</B> Saturday, May 10,
2003 8:36 PM<BR><B>To:</B>
nagiosplug-help@lists.sourceforge.net<BR><B>Subject:</B> [Nagiosplug-help]
FileHandles and Perl<BR><BR></FONT></DIV>
<DIV><FONT face=Arial size=2>Hi there,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I am developing a plugin in Perl that uses a file
to store and write values.</FONT></DIV>
<DIV><FONT face=Arial size=2>The program runs just fine from the commandline.
However now I tried to integrate it in Nagios and it gave some problems. I
found out that when the interpreter hits the open statement the programs
shuts down ie it doesnt do anything, and Nagios returns a Critical without any
data. Anything in front of this statement works but after it
doesn't.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>#it stop right here</FONT></DIV>
<DIV><FONT face=Arial size=2>open(FILEWRITE, "< counter.dat") or die
("Can't open counter.dat");<BR>@number = <FILEWRITE>;<BR>close
FILEWRITE;</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I use this "open" call to get some data out of a
file and use it for comparison and later I open it again and write to it
(depending).</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>This data is key to the program. My question is
whether there is another way around this. I need to open a file and read from
it, but somehow ePN doesn't allow this. Or am I overseeing something else
here?</FONT></DIV><FONT face=Arial size=2>
<DIV><BR>Thanks,</DIV>
<DIV> </DIV>
<DIV>Jan van den Berg</DIV>
<DIV> </DIV>
<DIV>PS reply to my email as I am not at work.
</FONT></DIV></BLOCKQUOTE></BODY></HTML>