Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Load modules from internet

by Jaap (Curate)
on Aug 02, 2002 at 14:14 UTC ( #187094=perlquestion: print w/replies, xml ) Need Help??

Jaap has asked for the wisdom of the Perl Monks concerning the following question:

Wouldn't it be great if Perl modules would be automatically loaded from CPAN/internet when a script 'use'-es it?

It would be easiest for modules that contain only Perl (no inline c or something).And it would be eaiest if it would not be from CPAN's .tar.gz files with a lot of other files.

It should load them over http since most connected machines have http access.

Java already has this i am told. Could we make this work for Perl?

Replies are listed 'Best First'.
Re: Load modules from internet
by Abigail-II (Bishop) on Aug 02, 2002 at 14:28 UTC
    That's already done. There's my The::Net module that allows you to do require "http://www.example.com/some/module.pm"; but I've also seen code on P5P that connects to CPAN. It's probably on CPAN someplace.

    I do not know what you mean by "It would be easiest if it would not be from CPAN's .tar.gz files".

    Now, just because it's possible doesn't mean I think it's a good thing to do. I find it scary enough to download something from CPAN and to actually install it, I do not want a program to do that automatically. And I certainly don't want to give such programs write access to /opt/perl/lib/site_perl.

    Abigail

Re: Load modules from internet
by perrin (Chancellor) on Aug 02, 2002 at 14:34 UTC
    Hey, that would be great! Then I can put up a module called Business::VerifyBankAccount. Once people start using it, I'll replace it with code that transfers all your money to my account and then reformats your hard drive. Since everyone will just be blindly installing and running whatever code I provide, they'll never know the difference! Oh yeah baby, this is gonna rock! I can finally stop sending all those Nigerian scam mailings.
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Load modules from internet
by dada (Chaplain) on Aug 02, 2002 at 14:26 UTC
    Juerd wrote a neat trick about this. but...

    And it would be eaiest if it would not be from CPAN's .tar.gz files with a lot of other files.

    you're asking too much here.

    cheers,
    Aldo

    __END__ $_=q,just perl,,s, , another ,,s,$, hacker,,print;
Re: Load modules from internet
by simeon2000 (Monk) on Aug 02, 2002 at 15:28 UTC
    This is a terribly Bad Thing(tm) if not done properly. Proper p|gpg and MD5'ing would have to take place. Plus... IIRC, perl is NOT system independent bytecode, so the module would have to be compiled before it could be run, and that would take a lot of extra time. Plus lots of perl modules are NOT written portably.

    The more I think about it, the more I think that this is a Very Bad Idea(tm) for perl.

    --
    perl -e "print qq/just another perl hacker who doesn't grok japh\n/"

Re: Load modules from internet
by Jaap (Curate) on Aug 02, 2002 at 15:10 UTC
    Hmmm so it is possible and it has been done. Good. BTW the modules don't have to be installed by default, just downloaded and put in memory or in the current directory.

    If the Modules were managed by a trusted party (that checks the modules for security things), it could well work.

    If Sun can do it with Java, so can we. It would also save people a lot of trouble installing the modules.

    I do sense however that most of you think it is a great security risk.
      Just because Sun can do it with Java doesn't mean Perl should do it too, especially if the goal is 'saving people trouble from installing modules'. Installing CPAN modules is quite easy in Perl (well, unless it's me trying to install Image::Magick), especially with tools like CPAN and CPANPLUS. If you have not already read A Guide to Installing Modules, please do.

      Personally, i think loading CPAN modules from the Internet is a neat idea ... but not very practical. I'll stick to my local copies, thank you. :)

      jeffa

      L-LL-L--L-LL-L--L-LL-L--
      -R--R-RR-R--R-RR-R--R-RR
      B--B--B--B--B--B--B--B--
      H---H---H---H---H---H---
      (the triplet paradiddle with high-hat)
      
Re: Load modules from internet
by Biker (Priest) on Aug 02, 2002 at 15:14 UTC

    If the security aspect could be solved (which I doubt) there would still exist a problem for off-line installations. Far from all computers are connected to the 'Net.


    Everything went worng, just as foreseen.

      Well, you wouldn't HAVE to use this, you just could if you wanted. The traditional methods still work of course.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://187094]
Approved by rob_au
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2022-06-25 23:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (83 votes). Check out past polls.

    Notices?