Re: Apache::File correction

2002-04-13 Thread Dominic Mitchell
Rob Nagler <[EMAIL PROTECTED]> writes: > > undef $/; # enable "slurp" mode > > I think the "local" is pretty important, especially in mod_perl: > > local $/; > > This has the same effect (the "undef" is unnecessary). It's also a > good idea to enclose the code in a subroutin

Re: Apache::File correction

2002-04-12 Thread Rob Nagler
> undef $/; # enable "slurp" mode I think the "local" is pretty important, especially in mod_perl: local $/; This has the same effect (the "undef" is unnecessary). It's also a good idea to enclose the code in a subroutine with error checking: sub read_file { my($

Re: Apache::File correction

2002-04-12 Thread Ernest Lergon
Martin Haase-Thomas wrote: > > [snip] Secondly I wonder whether "local $/ = undef" > will have any effect. But I've never tried overriding Perl's predefined > variables. > > regards Dear Martin, this is the well-known file-slurp mode. E.g.: undef $/; # enable "slurp" mode $

Re: Apache::File correction

2002-04-10 Thread Martin Haase-Thomas
Hi, maybe I don't exactly understand what you mean. To me it looks like you want to direct a stream into a file. Perhaps IO::Handle or IO::Scalar will provide what you need. Secondly I wonder whether "local $/ = undef" will have any effect. But I've never tried overriding Perl's predefined va

Re: Apache::File correction

2002-04-10 Thread Rasoul Hajikhani
Robert Landrum wrote: > > At 1:44 PM -0700 4/10/02, Rasoul Hajikhani wrote: > >Folks, > >The Apache::File man pages indicate that > > > >($name,$fh) = Apache::File->tmpfile; > > > >returns a fh ready to write to. So far so good. > > > >In case of wanting to read from it, here is what I do: > > >

Re: Apache::File correction

2002-04-10 Thread Robert Landrum
At 1:44 PM -0700 4/10/02, Rasoul Hajikhani wrote: >Folks, >The Apache::File man pages indicate that > >($name,$fh) = Apache::File->tmpfile; > >returns a fh ready to write to. So far so good. > >In case of wanting to read from it, here is what I do: > ># Is this necessary? >$fh->close() or die "Cou

Apache::File correction

2002-04-10 Thread Rasoul Hajikhani
Folks, The Apache::File man pages indicate that ($name,$fh) = Apache::File->tmpfile; returns a fh ready to write to. So far so good. In case of wanting to read from it, here is what I do: # Is this necessary? $fh->close() or die "Could not close $name: $!\n"; $fh->open("<$name"); local $/