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

Re: RFC 100 (v1) Embed full URI support into Perl

Thread Previous | Thread Next
From:
Nathan Wiger
Date:
August 15, 2000 18:43
Subject:
Re: RFC 100 (v1) Embed full URI support into Perl
Message ID:
3999F1A6.B26FEEA8@west.sun.com
Sam Tregar wrote:
>
> How is this better than File::Spec's approach?

File::Spec has the idea and representation dead on. However, the
interface is a pain; to write portable scripts you have to go through
some contortions.

With URI support, you still have to contort a little, but not as much.
Here's some better examples from an email I sent earlier:

   $fo = open "file://c/docs/personal";

   # Unix = /docs/personal    # here, 'c' becomes '/'
   # Mac  = :docs:personal    # here, 'c' becomes ':'
   # Win  = c:\docs\personal

Something like File::Spec can be used to perform the magic internally,
but you get the benefit of not having to call catfile explicitly. Perl
sees a URI and does its thing. Plus, URIs are familiar - most everyone
(even those unfamiliar with Perl) understands what the URI in the open
statement does.

Although the examples are terrible at showing it (sorry), full URI
support means more that just writing portable filenames. It means having
Perl understand http://, ftp://, etc, etc, so that it can do something
"really cool" with it. The upcoming v4 of RFC 14 will show how this is
an advantage.

-Nate

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