On Fri, 22 Apr 2005 14:24:25 -0400, Juerd <[EMAIL PROTECTED]> wrote:


Because a URI scheme ends in :. It http: followed by anything other than // should fail because it is invalid, not fall back to file handling. IFF you're handling URIs.

        multi sub open ($u of Str where /^mailto:\/\//, [EMAIL PROTECTED]) 
returns
        Handle  {...}

Well, it's mailto:[EMAIL PROTECTED], not mailto://[EMAIL PROTECTED]


True, I did not think of that. But it can at least be defined for most URI schemes to check for ://, in the case of HTTP, FTP, etc.


We're talking about the *built-in* functions here, right?

Anyway, is there any other URI scheme besides for mailto: that doesn't use <://>? mailto isn't something you can "open" really, for read at least. If it's for built-in, then only the most common protocols would be defined I imagine. The ones I can think of that you can read from/stream in use <://>, so I don't see why the methods for those protocols can't be defined with <://>. Maybe I'm missing something here though.. which does happen a lot ;)

Also, I don't know much about rules with regex yet, but could you do
something like...
        multi sub open ($u of Str where /<protocol(file)>/, [EMAIL PROTECTED]) 
returns
Handle {...}
Where < <protocol(file)> > expands to < file:// >

Yes, but it's probably easier to just use a hash: %protocol<file>.


Easier or more efficient?



Reply via email to