Re: Transaction Wrapper and Perl 5.6.1

[prev] [thread] [next] [Date index for 2004/09/02]

From: young
Subject: Re: Transaction Wrapper and Perl 5.6.1
Date: 18:54 on 02 Sep 2004
Tony Bowden wrote:

>On Wed, Sep 01, 2004 at 05:12:26PM -0500, Stuart Johnston wrote:
>  
>
>>found out that "local $class->db_Main->{AutoCommit};" inside of
>>do_transaction() subroutine caused memory leaks with Perl 5.6.1 from
>>www.class-dbi.com site.
>>Unfortunately, I'm using Perl 5.6.1 and trying to find the way to solve
>>this issue without upgrading Perl.
>>Does anybody know how to solve this issue or what causes memory leaks?
>>    
>>
>
>This was a bug in perl:
>  http://www.mail-archive.com/dbi-announce@xxxx.xxx/msg00010.html
>
>Tony
>  
>
Thanks Tony,
So..  I shouldn't worry about memory leaks when I don't use local on my 
do_transaction code below written in Perl 5.6.1..?

sub do_transaction {
  my ($class, $code, @args) = @_;
  $class->_invalid_object_method('do_transaction()') if ref ($class);
  $class->db_Main->{ AutoCommit } = 0;
  my @return_values;
  eval {
    @return_values = $code->(@args);
    $class->dbi_commit;
  };
  if ( $@ ) {
    my $error = $@;
    eval { $class->dbi_rollback; };
    if ($@) {
      my $rollback_error = $@;
      $class->_croak("Transaction aborted; $error; ".
        "Rollback failed: $rollback_error\n");
    } else {
      $class->_croak("Transaction aborted (rollback successful): $error\n");
    }
  }
  $class->db_Main->{ AutoCommit } = 1;
  return (@return_values);
}

Many many thanks..

-Young

Transaction Wrapper and Perl 5.6.1
Stuart Johnston 22:12 on 01 Sep 2004

Re: Transaction Wrapper and Perl 5.6.1
Edward J. Sabol 08:34 on 02 Sep 2004

Re: Transaction Wrapper and Perl 5.6.1
young 15:22 on 02 Sep 2004

Re: Transaction Wrapper and Perl 5.6.1
Edward J. Sabol 03:51 on 08 Sep 2004

Re: Transaction Wrapper and Perl 5.6.1
Tony Bowden 18:27 on 02 Sep 2004

Re: Transaction Wrapper and Perl 5.6.1
young 18:54 on 02 Sep 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52