in reply to dbmopen - if db file do this else do that
Are you trying to make sure that the DBM file exists before opening it? If so, you can do it in a somewhat more portable way:if ( (open FILE, "${sessionFile}.db"){ close FILE; dbmopen %stored, $sessionFile, 0655; %session = %stored; dbmclose %stored; return 1; } else {; return 0; }
This way you let the library deal with naming conventions. Note also that I changed your subroutine to not use global variables. You can call it as follows:sub sessionValidate{ my ($session, $file) = @_; my %stored; return 0 unless dbmopen %stored, $file, 0444; %$session = %stored; dbmclose %stored; }
--perlplexerif ( sessionValidate(\%session, "$systemRoot/sessions/$FORM{sessionI +D}") ){ # ... }else{ # ... }
|
|---|