develooper Front page | perl.perl6.language.io | Postings from August 2000

Re: RFC 14 (v2) Modify open() to support FileObjects and

Thread Previous | Thread Next
From:
Graham Barr
Date:
August 9, 2000 10:15
Subject:
Re: RFC 14 (v2) Modify open() to support FileObjects and
Message ID:
20000809155411.X437@pobox.com
On Wed, Aug 09, 2000 at 07:41:54AM -0700, Nathan Wiger wrote:
> > It occurs to me that one could embed the class name right in the first
> > argument:
> > 
> >   $perl = open 'ftp://ftp.linux.activestate.com/pub/staff/gsar/APC/'
> >     or die "ActiveState ftp site is hosed again: $!";
> 
> Yeah, the next version is going to include a syntax that's very similar
> to this, although a little more Perlish:
> 
>    open '/etc/passwd';     # file is implied
>    open ftp 'ftp://ftp.linux.activestate.com/'
>    open dir '/usr/local/bin'
>    open http 'http://www.yahoo.com/'
> 
> This will have the nice benefit of fitting within Perl's
> already-existing indirect object notation (so it can call ftp->open,
> dir->open, file->open, etc).

So in other word you are suggesting packages of these names which all
define an open method. IMO, that would be better than trying
to overload the open operator in umpteen different ways.

Graham.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About