turkanis has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
Is there ever a difference in semantics between
sub foo {
....
my $value = <expression>;
return $value;
}
and
sub foo {
....
return <expression>;
}
?
I ask this because I am experiencing a negative interaction between the Komodo remote debugger and the CPAN module DBIx::transaction. When debugging code that commits a transaction, I get an error like this:
panic: attempt to copy freed scalar 350d010 to 15c7b68 at /usr/share/komodo/perllib/perl5db.pl line 4341, <STDIN> line 1.
Strangely, I have found that I can fix the error by changing the definition of close_transaction in DBIx/Transaction/db.pm from
sub close_transaction {
my $self = shift;
my $method = shift;
my $code = DBI::db->can($method);
$self->{private_DBIx_Transaction_Level} = 0;
$self->clear_transaction_error;
$self->transaction_trace($method);
my $rv = $code->($self, @_);
return $rv;
}
to
sub close_transaction {
my $self = shift;
my $method = shift;
my $code = DBI::db->can($method);
$self->{private_DBIx_Transaction_Level} = 0;
$self->clear_transaction_error;
$self->transaction_trace($method);
return $code->($self, @_);
}
to me, it looks like my change should have no effect, and yet it eliminates the panic. What's going on here? Could it be a bug in the Komodo remote debugging libraries, or in the Perl implementation, or in DBIx::Transaction?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Attempt to copy freed scalar and return value semantics
by stephen (Priest) on May 24, 2013 at 17:39 UTC | |
|
Re: Attempt to copy freed scalar and return value semantics
by Laurent_R (Canon) on May 24, 2013 at 17:52 UTC | |
|
Re: Attempt to copy freed scalar and return value semantics
by flexvault (Monsignor) on May 24, 2013 at 18:16 UTC | |
by turkanis (Novice) on May 28, 2013 at 04:23 UTC |