Skip to content

Instantly share code, notes, and snippets.

@jberger
Created January 15, 2012 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jberger/1616923 to your computer and use it in GitHub Desktop.
Save jberger/1616923 to your computer and use it in GitHub Desktop.
Alien::Base tpf grant proposal

Alien::Base - Base classes for Alien:: modules

Name:

Joel Berger

Email:

joel.a.berger@gmail.com

Amount Requested:

$500

Synopsis

Artur Bergman's documentation for the Alien namespace specifically says that there is no framework for Alien:: modules, however, in writing Alien::GSL I find that most of the code I am writing has nothing to do with the GSL library and could as easily apply to many external libraries. I intend for Alien::Base to comprise some base classes for other Alien:: modules, including Alien::GSL.

Benefits to the Perl Community

Perl is great, CPAN is great, CPAN.pm and cpanminus are great, but if a module depends on an external library that is not installed, none of these can help. The Alien namespace has attempted to meet this demand by providing installers for external libraries needed by CPAN modules.

Sadly, comparitively few libraries are provided. In my opinion this is because writing the Alien module itself is too hard. With an Alien::Base system in place, perhaps more libraries could be provided and Perl would have an even larger base of available code to build from.

Deliverables

A CPAN distribution named Alien::Base, comprised of at least the classes:

  • Alien::Base - used as the base class for an Alien module (e.g. Alien::OtherLibrary), which is called by the dependent module (e.g. Something::Other::XS).

  • Alien::Base::ModuleBuild - a Module::Build subclass which handles the actions of fetching, building and installing the library.

  • Tests

  • Documentation

Project Details

Alien::Base::ModuleBuild will be able to

  • Query an FTP or HTTP server for a list of files

  • Fetch a file (archive) from either type of server, based on a required or else newest version

  • Extract the archive to a temporary directory

  • Perform a series of system calls to configure, build and install the library (to a File::ShareDir type folder)

  • Extract some information about the library and store it in a Module::Build::ConfigData storage module

Alien::Base will be able to

  • Provide the information about the library's local installation

  • Make the library available to a dependent module and/or its builder

The aim will be to allow much, if not all, of the subclass (i.e. Alien::OtherLibrary) specifics to be set with parameters/properties just like Module::Build installations, rather than by needing to write extra methods to do any of the above-listed tasks. I envision that the Build.PL for Alien::GSL could look like this (properties like alien_ are from Alien::Base):

use strict;
use warnings;

use Alien::Base::ModuleBuild;

my $builder = Alien::Base::ModuleBuild->new(
  module_name => 'Alien::GSL',
  dist_abstract => 'Easy installation of the GNU Scientific Library',
  license => 'perl',
  configure_requires => {
    'Alien::Base' => 0,
  },
  requires => {
    'perl' => '5.8.1',
    'Alien::Base' => 0,
  },
  dist_author => 'Joel A. Berger <joel.a.berger@gmail.com>',
  alien_name => 'gsl',
  alien_source_ftp => { 
    server  => 'ftp.gnu.org',
    folder  => '/gnu/gsl',
    pattern => qr/^gsl-([\d\.])+\.tar\.gz$/,
  },
);
$builder->create_build_script;

Initially I intend to focus on GNU libraries as they are fairly consistent in their build process. This should allow Alien:: authors to wrap this large and important set of libraries, employing only minimal configuration. I intend to use this for Alien::GSL and perhaps something like Alien::NCurses (i.e. a library I am not as familiar with) if I feel so inclined.

Hopefully the process will be sufficiently configurable so as to allow other non-GNU libraries to be wrapped easily. Certainly something involved like Alien::SDL isn't a prime candidate for this framework, but there are many smaller libraries which might benefit from being wrapped in this manner.

After initial releases, I hope that the community will help to make Alien::Base even more broadly applicable to more libraries.

Inch-stones

Each of the bullets under "Project Details" will serve as inch-stones.

Project Schedule

I have already begun working on Alien::Base; see it at https://github.com/jberger/Alien-Base. Development shouldn't take too long; I imagine only a few total weeks work should do the trick. Unfortunately my time cannot be given completely to this task since I am also currently working on my thesis (see "Bio"). Therefore, I propose that my project be 3-4 months (calendar) duration. Hopefully I will not need all that time. Also I have been trying to include tests as I code (countering a usual fault of mine) which is taking longer. This grant will help me to focus on this project for a shorter burst of development to completion, rather than working on it here and there as able.

Completeness Criteria

Distribution released to CPAN, complete with a decent test suite and documentation. Further convert Alien::GSL to the Alien::Base framework, giving an in-the-wild example for others to follow.

Bio

I am a Physics Ph.D. candidate at the University of Illinois at Chicago. I am writing a large simulation, a major part of my thesis, which uses Perl and my Math::GSLx::ODEIV2 module. This in turn requires version 1.15 of the GNU Scientific Library (GSL). I want my committee to be able to try out the simulation on their own; I have worked hard to make sure that it has a nice API, but certainly I cannot install it for each of them on their computers. Unfortunately, very few Linux distros come with this newest version of GSL (although this is always improving) and Windows users certainly will not have it.

My goal is to be able to have my committee members install Perl (Strawberry presumably on Windows) and my simulation module, which depends on Math::GSLx::ODEIV2 and therefore Alien::GSL (which would now depend on Alien::Base). From their perspective, I want it to be a totally transparent installation.

Since I have already made this effort, I would like it if my work on Alien::GSL could be used to make the task of writing other Alien:: modules easier for other authors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment