Jonathan Scott Duff wrote:
> If the proprietary modules were kept in a CPANish structure, then they
> could just point CPAN.pm at the machine with that structure.  CPAN.pm
> could also be modified such that the user gets to tell it where to
> look in detail (e.g., in some directory rather than on a CPAN mirror)
>

In perl6, CPAN.pm could be remodeled to allow a tree structure, such as DNS.
The host tries its hard disk (@INC), if it finds the module there, it uses
it. If it doesn't find, it looks for it on the local site archive. If the
site archive has it, the host downloads from it. Otherwise, the archive
requests the module from CPAN (or a higher level site-local archive, or even
the module's author site), downloads it, possibly caches it for other
requests, and passes it to the host, that caches it in his hard disk.
Periodically, the process is done again to verify if there are newer
versions of the module.

Security is an issue here. I heard of Penguin, but I don't know it. I'm not
sure if it could be used to run any module (not every module can run in a
restricted environment...).



> I think that, if you want this behavior, a module that implements it
> would be just fine.  (Why muck with "use"?)  To use a module name
> that seems like it could fit this purpose:
>
> use autoload { Bar => 'http://www.cpan.org/modules/Bar' },
>              { Baz => 'ftp://my.local.domain/perl-modules/Baz', VERSION =>
2 };

Very good idea indeed!!! Append the wishlist to add this module to perl6's
standard library!!!



> Here are some questions:
>
> * Is @INC searched prior to attempting to fetch the module via the URL?
Yes, unless on a periodic event, when the host looks for a more recent
version of the module. This could be disabled by a parameter.

> * If so, what happens if there is higher version in @INC?
I think the higher the better, but I think I saw in this thread some
suggestions on having a sub to verify which versions are allowed, like
 $VERSION >= 1.0 && $VERSION < 2.0 }. I think this would be good.

> * What happens when the module isn't found?
die... Possibly a sub parameter that is called when the module isn't found,
if the programmer wants the module but can live without it, but he wants to
provide something to handle the case in which the module is not found,
tipically to create stubs to the subs/classes the module would provide...

> * What happens when the requested version isn't found?
same as above.



If that's a common desire, I volunteer to help writing the beast. Can even
start it on Perl 5, and then convert it with p52p6. This way everyone can
see it and make critics before shipping it with Perl 6.

- Branden

Reply via email to