http://www.perlmonks.org?node_id=102172


in reply to select and IO::Handle

IO::Scalar does not return an IO::Handle, it returns a blessed hash reference. The author said he tried to subclass IO::Handle, but ran into 'xxx on unopened filehandle' warnings. You have to use methods on an IO::Scalar object, unless you are using the tied interface, but then you would be using a tied filehandle/glob.

I'm actually working on a patch for IO::Scalar so that it will return a blessed glob reference with a tied glob so that it will behave more like a real filehandle, and things that return IO::Scalar objects can be passed to things which expect filehandles. If there's a better fix, I'd be glad to hear of it :-)

Update: IO::Scalar now returns a blessed glob reference and so the returned object behaves more like a real filehandle. However, modern perls let you open a filehandle directly to a scalar, which makes these sorts of modules obsolete.