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

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

Thread Previous | Thread Next
From:
Jonathan Scott Duff
Date:
August 14, 2000 11:46
Subject:
Re: RFC 14 (v3) Modify open() to support FileObjects and
Message ID:
20000814135301.H30020@pobox.com
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
duff@cbi.tamucc.edu

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