I've spent several hours today chasing a problem that manifested itself
in a very subtle way. Consider this test code
require Fcntl;
use DBI;
sub foo {
@foo = Fcntl::show_want();
@foo = DBI::show_want();
@foo = Fcntl::show_want();
@foo = want();
}
sub want { print( wantarray ? "wantarray\n" : "wantscalar\n") }
$bar = foo();
@bar = foo();
where show_want() was implemented in DBI and Fcntl (for a test) as
int
show_want(...)
CODE:
dump_op(op);
puts( (GIMME == G_ARRAY) ? "want=array" : "want=scalar" );
The symptom was that the scalar vs list context of the call to
DBI::show_want did not reflect it's immediate calling context
but rather the context in which foo() was called! The surrounding
calls to Fcntl::show_want acted normally. Bizzare.
To cut a long and painful story short it seems to have been due to
version mismatch between perl and extensions. A rebuild of the DBI
against 1n fixed it. I can't be 100% sure since I don't have time
to dig deeper and I can't offhand see anything in the patch that
might have had that effect. Strange.
Sorry to be so vague. Just file it away into your symptom cache in
case anyone else bumps into something similar.
Tim.
p.s. I'll be away until Tuesday pm. Have the appropriate amount of fun!
in a very subtle way. Consider this test code
require Fcntl;
use DBI;
sub foo {
@foo = Fcntl::show_want();
@foo = DBI::show_want();
@foo = Fcntl::show_want();
@foo = want();
}
sub want { print( wantarray ? "wantarray\n" : "wantscalar\n") }
$bar = foo();
@bar = foo();
where show_want() was implemented in DBI and Fcntl (for a test) as
int
show_want(...)
CODE:
dump_op(op);
puts( (GIMME == G_ARRAY) ? "want=array" : "want=scalar" );
The symptom was that the scalar vs list context of the call to
DBI::show_want did not reflect it's immediate calling context
but rather the context in which foo() was called! The surrounding
calls to Fcntl::show_want acted normally. Bizzare.
To cut a long and painful story short it seems to have been due to
version mismatch between perl and extensions. A rebuild of the DBI
against 1n fixed it. I can't be 100% sure since I don't have time
to dig deeper and I can't offhand see anything in the patch that
might have had that effect. Strange.
Sorry to be so vague. Just file it away into your symptom cache in
case anyone else bumps into something similar.
Tim.
p.s. I'll be away until Tuesday pm. Have the appropriate amount of fun!