in reply to Re: CGI::Session->delete()
in thread CGI::Session->delete()

Here's the snippet:
my $session = new CGI::Session(undef, $query,{Directory=>"/tmp/data"}) +; $cookie = $query->cookie(CGISESSID => $session->id ); print $query->header(-cookie=>$cookie); print $query->start_html( "Blah Blah" ); $session->delete( ); $session->flush();

As you can see, I did try calling flush, but it doesn't help. I read your snippet (before posting no less 8-), but I thought that code was for maintenance of sessions that were abandoned.

The CGI::Session::File.pm code does an unlink on the file, but I haven't tried tracing the excetuion. Thanks again.

Replies are listed 'Best First'.
Re: Re: Re: CGI::Session->delete()
by LTjake (Prior) on Oct 22, 2003 at 19:39 UTC

    True, it is for expired sessions rather than explicitly deleted sessions but here's a one line change to do both:

    Change

    if ( time() >= $D->{ _SESSION_ETIME } + $D->{ _SESSION_ATIME } ) {

    To

    if ( time() >= $D->{ _SESSION_ETIME } + $D->{ _SESSION_ATIME } or $D-> +{ _STATUS } == 2 ) {

    Warning: untested.

    --
    "To err is human, but to really foul things up you need a computer." --Paul Ehrlich

      Thanks again,
      Sadly it was a Code 18 (the problem was 18 inches from the computer screen - better to admit it than confuse others). The script that deleted the session was called from another script that opened the session object. I'm thinking that when the inner script did the delete the OS prevented the unlink becase the outer script still had an open object.
      Either way, it works now.
      Regards.