Greetings,

I recently upgraded my version of perl to ActivePerl 5.6.1 (from 5.6.0), but now I seem to have a problem with code that used to work in 5.6.0...

The code all comes from a module I'm writing for a project I'm working on, this should be all the important code.

sub new { my $class = shift; if(ref $class){ $class->{_errstr} = "Unable to generate object from within objec +t"; return; } my %acess = @_; my $self = {_settings => 0,_divdir => 0, _divlist => 0,_members => +0,alog => ''}; #Preload any files they specify a need for #List of keys: # divisions # memberlist my($settings,$memblist,$path); croak "Unable to locate GMSSettings.gms in current path" unless(-e +"GMSSettings.gms"); $settings = new IniFile("GMSSettings.gms"); $path = $settings->get(['FILE','MEMBERDIRL'], -mapping => 0); if($acess{'divisions'} && $settings->get(['OTHER','DIVISIONS'], -ma +pping=>'single') ){ if(-e "$path/division.gms" && -e "$path/divlist.gms"){ $self->{_divdir} = new IniFile("$path/division.gms"); $self->{_divlist} = new IniFile("$path/divlist.gms"); }else{ croak "Unable to locate division.gms and/or divlist.gms in $p +ath"; } } if($acess{'memberlist'}){ if(-e "$path/memberlist.gms"){ $self->{_members} = new IniFile("$path/memberlist.gms"); }else{ croak "Unable to locate memberlist.gms in $path"; } } if($settings->get(['FILE','LOGACTION'],-mapping=>'single')){ local *LOGFILE; open(LOGFILE,">>$path/GMS.log") or croak("Unable to open logfile +! $!"); $self->{alog} = \*LOGFILE; my $temp = $self->{alog}; } $self->{_settings} = $settings; my $object = bless($self,$class); $GMS::LIVEOBJECT = $object; return $object; } sub logaction{ my $self = ref($_[0]) ? shift : 0; croak("Logaction is a METHOD. GMS object required.") if(!ref($self +)); return(1) unless($self->{_settings}->get(['FILE','LOGACTION'],-mapp +ing=>'single')); my $file = $self->{alog}; unless($file){ $self->{_errstr} = "Log not open!"; return; } my($uid,$ip); if($_[1] && $_[1] !~ m/\D/go){ $uid = $_[1]; }else{ my $temp = $self->verifylogin(); $uid = $temp->[1] || "???"; } $ip = $ENV{'REMOTE_ADDR'} || '???'; my $action = $_[0]; $action =~ s/\n|\r/<BR>/go; flock($file,2) if($self->getsetting('OTHER','FLOCK')); seek($file,0,2); print $file time.";$ip;$uid;$action\n";# or warn("UNABLE TO LOG!\n$ +!"); flock($file,8) if($self->getsetting('OTHER','FLOCK')); return(1); }


This is what happens when I try to test the code (does the same thing within the programs that are suppost to use it):
E:\Apache\cgi-bin\GMS>perl -w -e "use GMS; my $GMS = new GMS; $GMS->lo +gaction('test') or die($!);" seek() on unopened filehandle GMS::LOGFILE at GMS.pm line 271. print() on unopened filehandle GMS::LOGFILE at GMS.pm line 272. (in cleanup) Can't call method "EXISTS" on an undefined value at E: +/Perl/site/lib/IniFile.pm line 375 during global destruction.


If you need more information on anything, please just say so.

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

Edit by tye
Edit kudra, 2002-01-10 Changed title per ntc request


In reply to Problems with unopened filehandle after upgrade to ActivePerl 5.6.1 by Flame

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.