Today around 2:54pm, Nathan Wiger hammered out this masterpiece:

: > open "http://my.homepage.com"; # the file
: 
: Well, I think this is a bit of an edge case. If you really have a file
: named this, it would have to be in UNIX, named:
: 
:    http:/my.homepage.com
: 
: So, you'd have a UNIX directory named "http:" containing the file
: "my.homepage.com". The double // will get resolved because UNIX is nice
: to you. But other OSes (at least Windows) won't let you even create such
: a file.
: 
: However, I would argue that if you're creating files like this you may
: be in the need of psychiatric help.* :-) And I don't think it's a
: compelling enough argument to avoiding integrating URI support into
: Perl.

Please understand that I welcome this idea, in some fashion.  I brought up
this case because I haven't heard it yet, and it seems reasonable that
some one ( perhaps needing *'ed :) will do this, or is doing it, no doubt.

The "Don't do that" is a bad way to think about that potential 'bug'.

And many will consider it a bug.  However, I'm sure you've already come up
with the warning under -w that says:

  Don't do that - line 5.

Then they turn on diagnostics, or read perldiag.pod

  You must be an idiot to name a file just like a URI.  Honestly, such
  stupidity belongs else where, please refrain from opening this file with
  Perl... dummy. - line 5.

At any rate, when a file is open()ed without a default or registered
handler for it's supposed protocol, perl should ( at least ) first check
it the file exists ( -e ) in the local file system, before assuming it's,
for instance, http.

Such that:

sub open($) {
  my $file = shift;
  if ( $file =~ m{^http://} && ! -e $file ) {
    # handle with http.pm
  } else {
    # open as a file
  }
}

Or something to that effect.

: P.S. The *'ed part is meant in a joking manner, please take it
: lightheartedly. :-)

I'd think nothing less.

-- 
print(join(' ', qw(Casey R. Tweten)));my $sig={mail=>'[EMAIL PROTECTED]',site=>
'http://home.kiski.net/~crt'};print "\n",'.'x(length($sig->{site})+6),"\n";
print map{$_.': '.$sig->{$_}."\n"}sort{$sig->{$a}cmp$sig->{$b}}keys%{$sig};
my $VERSION = '0.01'; #'patched' by Jerrad Pierce <belg4mit at MIT dot EDU>

Reply via email to