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

[email protected] (Jonathan Scott Duff) Mon, 14 Aug 2000 13:53:01 -0500
Newsgroups perl.perl6.language.io
Message-ID <[email protected]>
On Sat, Aug 12, 2000 at 11:01:30PM -0400, Chaim Frenkel wrote:
> What hasn't been discussed, is 
> 
> Are files (or perhaps resources) named natively or in a portable fashion?
> 
> If portable, then
> 	for (@ARGV) { open $_; ... }
> has to DWIM both portable and native formats.
> 
> If native, then the URI has problems.

I'd say that the naming of files is up to the user.  If they choose to
name them in a portable fashion, they get the advantage of that for
loop working.

> There also comes the overhead (programming effort) of converting
> _some_ resource names to native format for output to the user.
> And deciding which of those resource names should be transformed
> will be tough.

Whatever the user gives Perl is what Perl will give back to the user.

> And how does one open sockets or connections to custom servers?
> 
> Will open take over the work of socket() and family? What is the
> resource supposed to look like?

I've thought of this as well and I think that open() *could* take over
socket() et alia but I'm not sure I'm comfortable with that idea yet.

Here are some imaginings:

	$fh = open "socket://www.perl.com:80:tcp";	# Hrm

	$fh = open socket "tcp://www.perl.com:80";

	$fh = open socket "www.perl.com:80", "tcp";

	$fh = open socket machine => "www.perl.com", 
	  		  port => 80, 
			  proto => "tcp";

-Scott
-- 
Jonathan Scott Duff
[email protected]