On Mon, Mar 10, 2008 at 7:43 AM, Jonathan Mast
<[EMAIL PROTECTED]> wrote:
> What benefit does flushing have? Would it help prevent memory
> leaks as per the above scenario or what?
Flushing gets the data out right away, in case there's anybody waiting
for it. In the case of log files, it means
Yeah I'm leaving it alone for now.
The socket server receives input episodically and could be invoked thousands
of times per minute. But typically it 2 or 3 times per hour.
It just seems to be a design flaw to do the repeated open/closing stuff
inside the while loop.
But something that just cam
Jonathan Mast wrote:
>
We have a socket server that, in addition to serving data, also writes
logging statements to a file.
My question concerns the correctness of how it accesses the log file. The
script is running continuously and all the log file IO stuff is inside the
main 'while' loop.
The
On Mon, Mar 10, 2008 at 10:08 AM, Jonathan Mast
<[EMAIL PROTECTED]> wrote:
> We have a socket server that, in addition to serving data, also writes
> logging statements to a file.
>
> My question concerns the correctness of how it accesses the log file. The
> script is running continuously and
Jonathan Mast wrote:
We have a socket server that, in addition to serving data, also writes
logging statements to a file.
My question concerns the correctness of how it accesses the log file. The
script is running continuously and all the log file IO stuff is inside the
main 'while' loop.
The f
On Wed, Jan 21, 2004 at 12:40:39AM -0500, Steve Grazzini wrote:
> But you have a syntax error as well, because the hash-dereference
> <$self->{filehandle}>
> ^..^
Ahh, I didn't notice that at all, I was wondering why it was complaining
about it...shoulda twigged :)
> You've already fo
On Tuesday, January 20, 2004, at 11:34 PM, Robin Sheat wrote:
Hey there, I'm not a total beginner to Perl, but am far enough into it
to have a lot of questions, so I hope this is a suitable place for them
:)
Fire away!
sub getResponse {
my $self = shift;
my $incoming = <$self->{filehandle}
Hi, Robin.
1st Situation.
I think the problem with " my $incoming = <$self->{filehandle}>; " it's that
Perl thinks that the expresion inside the < > is $self- and then expects a
semicolon but that semicolon isn't there.
2nd Situation.
Do you like this option ?
sub mySub {
$foo = shift;
Sorry, still can't get your logic... But there's a better approach
here :
open COUNT,"count.dat"; # ./ mean current dir, so, it's not nessary
open TEMP, "temp.dat" ;
Then , for the entire loop, you can read from COUNT, and write to TEMP.
At last, unlink the COUNT file, then rename the temp.dat
print COUNT "$image\=$count\n";
}
flock(COUNT, 8);
close (COUNT) or die "cannot close countfile: $!";
return 1;
}
-Original Message-
From: Connie Chan [mailto:[EMAIL PROTECTED]]
Sent: Saturday, July 27, 2002 4:57 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject
> > sub count {
> > open (COUNT, "+>./count.dat") or die "cannot open countfile: $!";
> > flock(COUNT, 2);
> >
> > while (){
> > if (m/BC0012/i){
> > ($key, $count) = split('=',$_);
> > $found = 1;
> > $count++;
> > } else {
> >
open(COUNT,") {
chomp;
if($_ =~ /BC0012/) {
my($key,$count) = split('=',$_);
$count++;
print "$count\n";
}
}
close(COUNT);
"David Gerler" <[EMAIL PROTECTED]> wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> okay... see
David Gerler wrote:
>
> okay... seems tonight is the night for regex... I have been looking at the
> emails that have been flying all evening.. I have tried to implement what I
> see.
>
> For some reason, mine don't work. Others say what they got in the email
> works. I try it and it don't.
>
>
At 03:48 PM 4/2/02 -0600, Mr Hash wrote:
>So, I'm trying to 'open ($1,">>$file")', where $1 is a string like
>"cbQosCMPrePolicyPktOverflow".
>
>Obviously, with use strict this does not work. How can I make it work? I
>need arbitrarily named filehandles. I know, it could get rended with
>gobblewort
From: Mr Hash <[EMAIL PROTECTED]>
> $1 is the resultant of a regex match. It don't need to be around very
> long, because I build a hash of open filehandles (key = filehandle
> string, value = file) at the time I open the file.
>
> And no, I don't close 'em! exit() does just fine.
Something lik
like:
>
> You REALLY shouldn't use $1 for a variable name, though, since it has a
> special meaning.
>
> -Original Message-
> From: David Gray [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 02, 2002 2:33 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
>
You REALLY shouldn't use $1 for a variable name, though, since it has a
special meaning.
-Original Message-
From: David Gray [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 02, 2002 2:33 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Filehandles named with a variable
> So, I'm trying to 'open ($1,">>$file")', where $1 is a string
> like "cbQosCMPrePolicyPktOverflow".
>
> Obviously, with use strict this does not work. How can I make
> it work? I need arbitrarily named filehandles. I know, it
> could get rended with gobbleworts if the data gets out of hand..
On Nov 2, Mike Gargiullo said:
>OK I know Perl is the language that lets you do things several different
>ways. So with that having been said, how can I convert the while
>statement into a subroutine and pas the filehandles to it ?
I'd make a function that takes two filenames, and does the work.
something like this
#
# Nothing special .. just opening the file handles
#
open(ONE,"one.dat") or die $!,"\n";
open(TWO,"two.dat") or die $!,"\n";
open(THREE,"three.dat") or die $!,"\n";
#
# sending the file handle into a reference as a glob
# you could also do thi
On Jun 23, Me said:
>> I want STDOUT to be sent to a FILESHANDLE. I have a script writing
>output
>> DISPLAY..But I wanna this to be going into a file through FILEHANDLES
>..
>>
>> Ur Help is Highly APPRECIATED
>
>open(STDOUT, ">foo") or die "can't redirect STDOUT: $!";
It's probably easier
if you want an explicit file handle, you'll have to do something like the
following:
open O, ">out.txt";
print O "whatever it is you need to print\n";
however, you can just reopen STDOUT and point it to a log file or something
rather then the default (display)
So i'm not sure i see the problem in
> I want STDOUT to be sent to a FILESHANDLE. I have a script writing
output
> DISPLAY..But I wanna this to be going into a file through FILEHANDLES
..
>
> Ur Help is Highly APPRECIATED
Well I'll SEE if I can HELP YOU.
open(STDOUT, ">foo") or die "can't redirect STDOUT: $!";
HOPE THIS HELPS.
If you are using print then just include the FILEHANDLE before the message
(make sure that you open the file first) ie:
print FILE "hello";
mainly this means that most things that spit out messages toward STDOUT as
a default.
print "hello";
is the same as:
print STDOUT "hello";
I hope that
24 matches
Mail list logo