perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Richter" <rich...@ecos.de>
Subject Re: Can you keep a regular file handle open in cache?
Date Wed, 05 Feb 2003 04:30:59 GMT


>I want my debug output to go in the same place as my Postgresql log file so
>they are chronologically mingled.
>I have a req->dbug routine that appends info to a text file but it opens
and
>closes the file each call.
>I want to open the file in append mode and keep it open in cache like the
>Postgres database is kept open in cache.
>Can I do this?

Open the file with FileHandle -> open so you get it in a scalar, then you
can either save it in the application object and only call open if it's
undef e.g.

$req->app->{fh} ||= FileHandle -> open (  ) ;

You may also you a global variable for saveing your filehandle, which must
be either in another namespace, so it's not cleaned up by Embperl or it's
name muts be added to %CLEANUP with value 0.

Gerald



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message