in reply to Re: Bug in __DATA__ filehandle
in thread Bug in __DATA__ filehandle
Test::Bar is a template, which inherits Test::Foo.
Test::Foo reaches into Test::Bar and sticks everything from Test::Bar::__DATA__ into $Test::Bar::T at constructor time. Subsquent objects evaluate $Test::Bar::T for content and should never touch __DATA__.
So no matter what, there should only ever be one access of the __DATA__ handle. The bug is kindof chicken and egg. If I warn from the function right before the filehandle read, the warning only occurs once, confirming that Test::Foo::loadfh() is only called once, yet the data stored in $Test::Bar::T apparently changes after the second socket connection. So something is getting called twice, but it is not function that is reading the filehandle.
When I was tweaking, I did a: warn(tell($fh)), and it reported a negative file index. I am assuming that shouldn't happen. Can anyone confirm that a tell() should not report a negative file index?