Hi Folks,
I received some tips from an admin on a server where I am attempting
to get a program running under mod_perl using Apache::Registry
All was well for a few weeks, and then data files began to be corrupted
again... One of the items that was passed on to me was ( as below) regarding
global variables. I am confident that there are no evil globals left, but I don't
understand ( or don't want to believe ) what he told me about file handles.
> #1. GLOBAL VARIABLES. Most perl programmers neglect to use my for
> every variable type. And even if they can be broken of this bad habit they
> continue to use global globs (as used with the open(FI, " Solution? use the FileHandle module;
> use FileHandle;
>
> then convert code that looks like this:
> open(FI, " my $line=;
> close(FI);
> to this:
> my $fi = new FileHandle " $fi->getline(); # or <$fi>
> $fi->close(); # or ignore it; PERL has garbage collection...
>
> you SHOULD also be able to simply use:
> my *FI;
> but... that looks really silly...
I have read the following in the guide:
::Output of system, exec and open PIPE, "|program" calls will not be sent
::to the browser unless you Perl was configured with sfio.
I am not sending the output to the browser, but opening sendmail like so
open (MAIL, "|$mail_program") || die "Could Not Open Mail Program: $!"; is
not working. That I can work out. However, is this true about regular opens
on files?
I use a lot of basic file opens like so:
open(CUSTOMERS,"<$c{globals}{root_dir}/admin/customers.txt") or die "Can't open the
customers list: $!";
Besides die being a bad thing, is this gentleman right to tell me
I have to loose my file opens and go with FileHandle ??
Any help would be Greatly appreciated.
Frustration is running high on this one.
Thanks,
Barry