I wrote this to solve a problem where I wanted to use a module on one machine that resides on another. The module goes like so:
package RemoteModule; =item Copyright 2004 John Drago <john.drago@e-commedia.com> This software is free software and may be distributed under the same terms as perl itself, so long as this copyright notice is included. Dependancies: LWP::UserAgent HTTP::Request::Common Synopsis: use RemoteModule "Crypt::RC4" => "http://search.cpan.org/src/S +IFUKURT/Crypt-RC4-2.02/RC4.pm"; use Crypt::RC4; my $crypted = RC4("secret password!!!", "Text to be encrypted!"); print "Encrypted: $crypted\n"; print "Decrypted: " . RC4( "secret password!!!", $crypted ); =cut use strict; my %urls = (); #======================================================== # #======================================================== sub import { my ($s) = shift; my ($class,$url) = @_; $urls{$class} = $url; }# end BEGIN{} #======================================================== # #======================================================== BEGIN { push @INC, sub { my ( $coderef, $filename ) = @_; $filename =~ s/\//::/g; $filename =~ s/\.pm$//; return undef unless defined $urls{$filename}; open my $fh, "perl " . " -MHTTP::Request::Common " . " -MLWP::UserAgent " . " -e \"print LWP::UserAgent->new->request( " . " GET '$urls{$filename}' " . " )->content\" | "; return $fh; }; }# end BEGIN 1;
Anyone come across a better method for achieving the same effect?

In reply to Using Remote Modules over HTTP by jdrago_999

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.