in reply to Problems with unopened filehandle after upgrade to ActivePerl 5.6.1

Afer some experementation with sleep and a file monitor, I have to conclude it close immediately after this block..

if($settings->get(['FILE','LOGACTION'],-mapping=>'single')){ local *LOGFILE; open(LOGFILE,">>$path/GMS.log") or croak("Unable to open logfile +! $!"); print STDERR "Opening!"; sleep 5; $self->{alog} = \*LOGFILE; my $temp = $self->{alog}; }


Something to to with the local declaration? Is there any other way to keep the filehandle from interfering with others of the same name that might be used?

Thanks


-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GIT d- s:++ a--- C++++ UL P+++>++++ L+ E- W++>+++ N !o K- w+ O---- M-- V--
PS PE Y- PGP t++(+++) 5(+++)++++ X R+@ tv+ b+++ DI+ D- G e->+++ h! r-- y-
------END GEEK CODE BLOCK------
Translate

"Weird things happen, get used to it."

Flame ~ Lead Programmer: GMS

  • Comment on Re: Problems with unopened filehandle after upgrade to ActivePerl 5.6.1
  • Download Code

Replies are listed 'Best First'.
Re: Re: Problems with unopened filehandle after upgrade to ActivePerl 5.6.1
by blakem (Monsignor) on Jan 11, 2002 at 04:40 UTC
    Try changing this line:
    $self->{alog} = \*LOGFILE;
    To this:
    $self->{alog} = *LOGFILE;
    And let me know if it works....

    -Blake

      That did it, I don't understand why though... did they change something that I didn't catch in the docs? It was always working fine like that before...


      -----BEGIN GEEK CODE BLOCK-----
      Version: 3.12
      GIT d- s:++ a--- C++++ UL P+++>++++ L+ E- W++>+++ N !o K- w+ O---- M-- V--
      PS PE Y- PGP t++(+++) 5(+++)++++ X R+@ tv+ b+++ DI+ D- G e->+++ h! r-- y-
      ------END GEEK CODE BLOCK------
      Translate

      "Weird things happen, get used to it."

      Flame ~ Lead Programmer: GMS

        No idea why it worked... my typeglob-fu is somewhat weak. I just happened to notice it while fiddling around with your example. Here are some smallest-case scenerios:
        #### in 5.6.1 *F works, but \*F fails % perl5.6.1 -we'{local *F; $tmp=*F; open F,">out"} print $tmp $tmp'; % cat out *main::F % perl5.6.1 -we'{local *F; $tmp=\*F; open F,">out"} print $tmp $tmp'; print() on unopened filehandle F at -e line 1.

        -Blake