Re: How to tell if subroutine param is filehandle

2004-02-01 Thread Jeff 'japhy' Pinyan
On Feb 1, [EMAIL PROTECTED] said: >Is there a way for a subroutine to tell when it got passed a FILEHANDLE? You could test to see if its ref() returns "GLOB" or "IO::File" or "IO::Handle", etc., but I think it's a nifty idea to do: if (defined fileno($arg)) { # it's an open filehandle }

How to tell if subroutine param is filehandle

2004-02-01 Thread mcdavis941
Hi, Is there a way for a subroutine to tell when it got passed a FILEHANDLE? Running a quick test suggests a way, which is to check the first char of the result of interpolating the subroutine param as a string. Can anyone say whether this is robust and if not what might be a better approach?