Hildo Biersma wrote:
> Jon Ericson wrote:
> > You misunderstand. I want to write this:
> >
> > open my $file, '/path/to/file' or die "can't open $file: $!";
> > # code passes
> > # /path/to/file is removed by another process
> > # dang! what file did I open?
> > print "I opened $file\n"; # ahh! that was it
>
> As cool as this may be, it also inhibits us from using alternative
> 'to_string' operations on filehandles, including bytes read, position,
> type (socket/pipe/file), etc. I'd rather see a more OO approach where
> you'd have to do $file->{name}.
I'd like to refer you to RFC 28:
Some things just don't need heavy object orientation. B<Most> things
don't need heavy object orientation, and it's not Perlthink to force
programmers into onerous routine they don't need; I'd hate it to get to
the stage where I can't write a one-liner because I have to instantiate
a class and wibble an object and who the hell knows what else. The CS
types may love it, but I'm a programmer and I don't. Let's keep making
easy things easy.
Finding out what file I opened should be easy. Its something I'd like
to have in Perl 5. Those other things are cruft as far as I'm
concerned. If they exist, I don't want to have to know about them.
(Until I need to know how many bytes I've read from a file :)
Jon
--
Knowledge is that which remains when what is
learned is forgotten. - Mr. King