Subject: | IO::Wrap::wraphandle doesn't handle Scalars or Arrays |
wraphandle() should receive anything and return a IO::Handle type object
if at all possible.
However, it does not cope with things which are handled by IO::Scalar or
IO::Lines. Hence I need to wrap calls to wraphandle() in the following code:
unless (ref $ref) {
return wraphandle($ref) if ref =~ /^STD(ERR|IN|OUT)$/;
return new IO::Scalar \$ref;
}
return new IO::Scalar $ref if (ref $ref eq 'SCALAR');
return new IO::Lines $ref if (ref $ref eq 'ARRAY');
# Hope that IO::Wrap::wraphandle can handle it.
return wraphandle($ref);
Could this be incorporated into wraphandle() itself?