[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
getting dirhandles and formats from *foo
Hey, while brushing up on typeglobs, I figured out how to determine if a
filehandle has been brought into being yet:
print defined *FOO{IO};
However, *FOO{IO} only works for filehandles and dirhandles. And about
those dirhandles... I note IO::Handle doesn't appear to be /about/
dirhandles at all -- I didn't see any related methods. However, doing:
opendir A, ".";
open B, "foo";
print defined(*A{IO}) ? 1 : 0;
print defined(*B{IO}) ? 1 : 0;
print defined(*C{IO}) ? 1 : 0;
prints 110, as expected. I guess part of the hassle is that filehandles,
dirhandles, and formats are not "top-level" Perl objects, as are scalars,
arrays, hashes, subroutines...
I'm puzzled at how to get formats out of a glob. :) I guess, though, it's
not needed at all.
--
MIDN 4/C PINYAN, USNR, NROTCURPI http://www.pobox.com/~japhy/
jeff pinyan: japhy@pobox.com perl stuff: japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]