in reply to Judiciously avoiding DESTROY method for CGI::Session clobber prevention

So, what I believe would help this is to be able to override the DESTROY method for existing objects without changing the source -- essentially, prevent them from running DESTROY, so that they don't flush to disk without my explicit approval.

Ok, so what happened when you tried that? There isn't anything stopping you from overriding the DESTROY method using somethin like use CGI::Session; sub CGI::Session::DESTROY { }. Of course a better solution would be to switch to something that is intended to work with mod_perl, such as Apache::Session.


We're not surrounded, we're in a target-rich environment!
  • Comment on Re: Judiciously avoiding DESTROY method for CGI::Session clobber prevention
  • Download Code

Replies are listed 'Best First'.
Re^2: Judiciously avoiding DESTROY method for CGI::Session clobber prevention
by rlucas (Scribe) on Jun 08, 2005 at 21:32 UTC
    That's certainly doable. But I'd like to be able to take $instance and vanquish $instance without having to change the class code; for example, I'd like to avoid the possibility of nonorthogonality to other possible uses of the CGI::Session code in my mod_perl instance.

    I have the inkling there may be something like this in the guts of Perl's OO code.

      There is, if you are sure it's what you want.
      my $instance; ... if (want to disable destroy) { package My::Private::DESTROYless::CGI::Session; sub DESTROY { } @ISA = 'CGI::Session'; bless $instance; }