Software versions:
  mod_perl-1.99_12-2
  perl-5.8.3-17.5.legacy
  httpd-2.0.51-1.10.legacy
  Fedora Core 1 (kernel 2.4.22-1.2199.8.legacy.nptl)

I have a custom application running under Apache::Registry w/mod_perl
using strict and warnings everywhere.

I have run into a case where sometimes a subroutine variable declared
with my() inside an OO method retains its value somehow(!?!).  I think I
must be going crazy.  The code looks like this:

 sub validate {
     my $app     = shift;
     my $custid  = $app->get_session_var('id') || "";
     my $sub_rec = $app->get_subscriber_rec($custid) if($custid);
     my $uid_int = $sub_rec->{'uid_int'}             if($sub_rec);

     {
         no warnings 'uninitialized';
         warn("custid($custid) sub_rec($sub_rec) uid_int($uid_int)\n");
     }
     return $uid_int;
 }

Output logged:
 custid() sub_rec() uid_int(4641)

Somehow $uid_int has a value (4641 in this case) even though $sub_rec is
not set!

In theory this should be impossible, right?  If $sub_rec is not set then
$uid_int could ONLY be undef, right?

I haven't yet setup a test platform that I can run this on repeatedly to
see how reproducible this really is.

I'm considering changing all code to explicitly set $sub_rec and
$uid_int to undef first before doing anything else which should make
this problem go away in theory, but if anyone sees something obvious
here I'm missing please let me know.

Sincerely,
Phil
--
Phillip E. Lobbes
[EMAIL PROTECTED]

Reply via email to