lib::http - Uses a Perl libray diretory over the internet using the HTTP protocol.
This module enables the use of a Perl libray diretory over the internet using the HTTP protocol.
Also you can use libhttp-perl, that is a TinyPerl (http://tinyperl.sf.net) modified, that doesn't have any library, only the basics to load lib::http, than the rest of the library you load over the internet. By default a library at http://tinyperl.sf.net/libhttp/ is used, so you can have a full Perl working without install a full Perl.
You can use this module from your code:
#!/usr/bin/perl use lib::http 'http://tinyperl.sf.net/libhttp/perl-lib-5.8.6-Win32' ; ## Loading XML::Smart over the internet! ;-P use XML::Smart ; my $xml = XML::Smart->new() ; ...
or from a modified Perl, libhttp-perl, that is distributed with the sources of this module and should be at ./libhttp-perl:
$> libhttp-perl anyscript.pl
To define what libraries URI libhttp-perl will use define them in the file libhttp.conf that should be in the same path of the binary of libhttp-perl. Here's an example:
lib::http works with any simple HTTP Server. To setup a library in the web server just copy all the library files of an installed Perl to a directory that can be accessed from the Web Server. Also you can link /usr/loca/lib/perl5/ to a directory that the Web Server can show.
To make the usage of the remote library faster you can use the libhttp script that will scan the library, create an index file and create compressed versions of the files. So, with the index you will make less calls to the server and the compressed files will save bandwidth.
Preparing the library:
$> libhttp /www/path/to/perl-lib-os-xxx/
Cleanning the files added in the prepare stage (undo the command above):
$> libhttp /www/path/to/perl-lib-os-xxx/ clean
By default lib::http will save the loaded files from the internet in a cache directory that will work as a normal Perl library.
The location of the cache directory will be a temporary directory in the default temporary directory of the system. If a ./libhttp directory exists in the current path it will be used as a static path that can be reused after many executions. By default the temporary directory will be cleanned after each execution.
To hide files from the cache, in other words, to not store fisically a file, you can use a "macro" that will force to load the file only in the memory, so, you can have restricted modules loaded from the internet without store them in the local host:
package TopSecret ; ## lib::http => hidden_file $var = 123 ; 1;
So, if "lib:http = hidden_file"> is found as a commnet in your file, the file will be loaded directly from the memory.
Graciliano M. P. <email@example.com>
I will appreciate any type of feedback (include your opinions and/or suggestions). ;-P
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.