[added -io cross-post]

John Porter wrote:
> 
> Just MHO, but I don't think this is the kind of thing that should
> go in the core.  Just MHO.

I think I agree. Just to clarify, the only reason it's an RFC and not
just a Perl 5 module is because RFC 14 (the one on a new open()) relies
on a handler concept for dealing with different file types:

   open file "/etc/motd";              # file handler (default)
   open dir "</usr/local/bin";         # dir handler
   open http "http://www.yahoo.com";   # http handler

This type of abstraction would allow you to import custom modules and
register them as http handlers without having to change your main code.
It also prevents bloat in the IO routines which would otherwise have
hardwired-in ways of dealing with this. Modularization lets us update
modules that do http manipulation via CPAN without having to release a
new version of Perl.

Nonetheless, this may not be the best way to go. Perhaps by default, an
"http.pm" is provided which allows basic http operations, and is
automatically imported, allowing you to say:

   open http "http://www.foobar.com"

natively without having a bunch of "use" statements at the top of your
code. Then, if you wanted to override this you could:

   use Class::Handler;
   handler http => 'LWP::UserAgent';

   open http "http://www.foobar.com";  # now uses the http handler
                                       # instead of native http.pm

Comments welcome.

-Nate

Reply via email to