I've been working on this post for a while, but only just had chance to 
finish my initial test. I'm working toward a solution which I hope will 
have a good impact for Perl... To finish planning it out and prove that 
it can work I need to get a few things straight about CPAN.


I'm sure I've missed important things out, or even some of the following 
information is wrong. If you'd be kind enough to help me fill in the 
blanks it'd be much appreciated. Bits I'm really not sure on are 
generally marked with ??


CPAN is an archive of Perl Modules that fellow programmers have made 
available for us to use. It's mirrored across many servers around the globe.
Any Perl programmer can apply for a CPAN account and can upload their 
modules to share.
Modules are archived usually in a tar.gz or zip, and contain a makefile, 
the .pm and hopefully some tests and documentation.


CPAN testers or CPANTS for short are people who test uploaded modules, 
trying to install them on their copy of Perl and upload a build report 
for others to see. (what is there motivation? Are a lot of them working 
for different distros?)


CPAN.pm is a module used to install modules from CPAN, downloading their 
archive and building. Any required XS C libraries are compiled at this 
stage, generally using gcc and make. Sometimes C libraries need to be 
downloaded and installed separately. There is also the command line 
'cpan' shell which utilizes this module.


PPM is a system for distributing pre-compiled Perl modules, where any XS 
C libraries have already been compiled and are a part of the archive. 
PPM packages can be made for any platform (Linux, Windows, etc) but are 
predominantly used for Windows with the main repository being 
ActiveStates which is created using an auto build process. (I've yet to 
find a Linux repository) - actually I've since stumbled across 
http://ppm.activestate.com/PPMPackages/zips/ showing that ActiveState do 
Linux ppm builds, although not as frequently.



Installing CPAN modules:-

Linux users with root access can install CPAN modules either:-

Packages such as RPM's from their Linux distro, this is usually only 
available for popular or difficult to install Perl modules. (I ended up 
using this recently when CPAN.pm failed to install DBD::mysql on CentOS 5)
'perl -mCPAN -e shell;' or 'cpan'.
Downloading, archives and building individually (an absolute nightmare 
when there are a lot of dependencies, imagine trying to do this for Jifty!)
using ppm

Linux users with shell access can install CPAN modules either:-

'perl -mCPAN -e shell;' or 'cpan' installing to a local directory, 
although they'll need to amend all their Perl scripts to include this 
folder, or there is an environment variable they can set?? Would the 
environment variable work for CGI scripts?? Their account may not have 
access to gcc and make??
Downloading, archives and building individually. Same issues as above??
using ppm???

Linux users with only FTP accounts (i.e. shared hosting environment)

Downloading modules manually, problems:-
Autoloader modules - either uncomments 'use Autoloader;' in each module 
or build on a similar system and copy over the /auto/ folder.
XS modules - I've heard that if you build the module on a similar 
system, you can just upload the Perl modules and c libraries, with a bit 
of tweeking it'll work?? Can someone verify this??  -- I've done a 
simple Windows based test, details at bottom of this post.
Need to update all Perl scripts to include local module directory "use 
lib 'cpanlib';"


Windows users with root access can install CPAN modules either:-

'cpan' shell as long as they have a good c compiler and make available. 
Although this can be a painful experience.
Downloading, archives and building individually, again they need make 
and c compiler.
using ppm

Windows users with shell access can install CPAN modules either:-

'cpan' shell as long as they have a good c compiler and make available????
Downloading, archives and building individually, again they need make 
and c compiler????
using ppm????

Windows users with only FTP accounts (i.e. shared hosting environment)

Same issues as Linux FTP users.




Test: Installing an XS pm on Windows without ppm or cpan, into a 
separate folder (i.e. outside c:\perl)


I say not using ppm, but I'm going to cheat a little and use the ppm zip 
file for my example module clone.pm. I'm assuming that building the ppm 
.zip file does most of the hard work and the ppm install command line 
utility isn't much more than a simple installer.


Let's start by making a test script and installing clone normally 
through ppm to show that the module works. (yes I know I should use 
clones .t files)

clonetest.pl

#!/perl/bin/perl
use Test::More 'no_plan';
use_ok( 'clone' );


test that it fails without clone installed.

perl clonetest.pl

C:\clonetest>perl clonetest.pl
not ok 1 - use clone;
#   Failed test 'use clone;'
#   at clonetest.pl line 3.
#     Tried to use 'clone'.
#     Error:  Can't locate clone.pm in @INC (@INC contains: 
C:/Perl/site/lib C:/
Perl/lib .) at (eval 2) line 2.
# BEGIN failed--compilation aborted at (eval 2) line 2.
1..1
# Looks like you failed 1 test of 1.


Good. Now check that it wont pass if I simply copy over the clone.pm file.

C:\clonetest>perl clonetest.pl
not ok 1 - use clone;
#   Failed test 'use clone;'
#   at clonetest.pl line 3.
#     Tried to use 'clone'.
#     Error:  Can't locate loadable object for module Clone in @INC 
(@INC contai
ns: C:/Perl/site/lib C:/Perl/lib .) at (eval 2) line 2
# Compilation failed in require at (eval 2) line 2.
# BEGIN failed--compilation aborted at (eval 2) line 2.
1..1
# Looks like you failed 1 test of 1.

Ok, errors as expected. Now lets delete the copied over clone.pm file 
and install clone with ppm to show that it works.

ppm install clone

C:\clonetest>perl clonetest.pl
ok 1 - use clone;
1..1

Ok, works as expected. Now remove clone by ppm.

ppm remove clone


Right we are ready to do the test. When I installed by ppm I got a 
little report:-

Clone
recursively copy Perl datatypes
    Version:    0.28
    Author: Ray Finch ([EMAIL PROTECTED])
    CPAN:   http://search.cpan.org/dist/Clone-0.28/

Installed files:
    C:/Perl/html/site/lib/Clone.html
    C:/Perl/site/lib/Clone.pm
    C:/Perl/site/lib/auto/Clone/.packlist
    C:/Perl/site/lib/auto/Clone/Clone.bs
    C:/Perl/site/lib/auto/Clone/Clone.dll
    C:/Perl/site/lib/auto/Clone/Clone.exp
    C:/Perl/site/lib/auto/Clone/Clone.lib
    C:/Perl/site/lib/auto/Clone/autosplit.ix
   

So I know that with these files in these folders clone will work. Lets 
grab the clone zip file from ActiveState:-
http://ppm.activestate.com/PPMPackages/zips/8xx-builds-only/Windows/Clone-0.28.zip

Looks like it's got everything I need apart from .packlist... I'll see 
if I can get by without it.

Extracting the files to:-

    C:/clonetest/Clone.pm
#    C:/clonetest/auto/Clone/.packlist
    C:/clonetest/auto/Clone/Clone.bs
    C:/clonetest/auto/Clone/Clone.dll
    C:/clonetest/auto/Clone/Clone.exp
    C:/clonetest/auto/Clone/Clone.lib
    C:/clonetest/auto/Clone/autosplit.ix

There were a couple of .exists files that I've ignored. I also skipped 
the .html file.

The moment of truth..

C:\clonetest>perl clonetest.pl
ok 1 - use clone;
1..1

Brilliant. So it appears you can install XS Perl modules without ppm or 
cpan (although borrowing from ppm).

To verify this properly I need to test an upload to a live Windows 
shared hosting account. All my hosting servers are Linux. Does anyone 
have a shared hosting Windows account that they wouldn't mind me using?



Lyle

_______________________________________________
BristolBathPM mailing list
[email protected]
http://mailman.bristolbath.org/mailman/listinfo/bristolbathpm

Reply via email to