October 2011 Archives

Announcing Alien::GSL 0.03_04 plus some Module::Build questions

Hello everyone,

This note is to announce that Alien::GSL dev release 0.03_04 has be uploaded to CPAN and should be available shortly.

After lots of good feedback from Rob (Sisyphus) and learning lots about the warts in Module::Build, I think I have a more robust system in place now.

New features include:

  • smarter warnings for missing configure_requires dependencies
  • parse gsl.pc to get up-to-date compiler flag, no longer depends on hard coding things like -lgsl
  • rewrite gsl.pc before installing to provide correct paths relative to share_dir location
  • new gsl_pkgconfig_location function provides the path to the folder containing the rewritten gsl.pc file
  • includes gsl-config.pl which should behave like gsl-config but relies on Alien::GSL and its notion of the GSL libraries (this still considered work-in-progess)
  • more tests!! (required adding the ability to hook into $Alien::GSL::share_dir, since tests happen before install, and thus before placement into the location that File::ShareDir expects)

Some notes on Module::Build:

  • why does ACTION_install redo ACTION_code? This is a problem when ACTION_code does something time consuming. I am avoiding by checking state and skipping ahead to the SUPER::ACTION_code, but this seems like it shouldn’t be necessary.
  • There should be some way to handle configure requires dependencies better. I know it must be tricky, but perhaps a class method which can vaildate the hash which will be passed to the constructor would help.
  • Can ACTION_install be rerun after itself for example:
    1. ACTION_install
    2. munge gsl.pc (pkg-config information) using the actual install File::ShareDir path rather than assuming the install location will be as expected
    3. ACTION_install to re-install new copy of gsl.pc

Anyway I hope to hear some feedback. Assuming this version works correctly, I intend to work on some of the things in the TODO section and eventually release a stable version, then simultaneously convert Math::GSLx::ODEIV2 to use it.

Cheers, Joel Berger

(originally sent to PDL mailing list)

Tied Variables: One more reason to love Perl

As many of you know, tied variables lend extra magic to an otherwise normal Perl variable.

One of my favorites comes from File::chdir. This provides your Perl script with $CWD and @CWD. When a folder is assigned to $CWD or pushed onto @CWD the working directory is changed, in a platform independent way. The coolest thing about this is if you first local $CWD, then this change in the working directory is done locally to the block, and is undone as the scope ends.

I just released version 0.03 of Tie::Array::CSV. This module allows accessing a CSV file (or other separator parsable by Text::CSV), using a Perl array.

Underneath the hood there is more tie magic! Tie::Array::CSV uses Tie::File which provides random line access to a file as a Perl array. Using this module in mine allows the module to pick the row just like my users will, as an array index.

Version 0.03 adds a new constructor. So that the users don’t even need to be aware of the tie usage, which looks a little strange at first.

As far as I am aware, other languages don’t have anything like tie. Just one more reason to love Perl! Which other Tie classes do you find especially interesting?

Announcing Alien::GSL 0.03_01

I have now released a dev version 0.03_01. If any interested parties can spare a few moments, please try installing it and let me know if it behaves for you.

For Linux users:

- If GSL is installed, it should find it and install should complete quickly
- If not, it should download the source
---- if installed as root, it should install system-wide
---- if not root, it should install in a File::ShareDir

For Windows users:
it should download a precompiled version (GSL 1.15) from my work server (hopefully not the final location for this download) a…

Request for Difficult Differential Equations

Firstly I would like to mention that I have just released version 0.06 of Math::GSLx::ODEIV2. For those of you who aren’t familiar with it (most of you I’m sure) this module represents a Perl-ish interface to the new GSL ordinary differential equation solver.

The major improvement of this version of my Perl module is the handling the Jacobian of the ode system. This allows the use all of the step functions in the original C library. In fact, other than one small feature that I would like to add (specifying quantity specific error limits), the module is just about feature complete.

The problem is that it needs some testing love. Certainly I need to add more tests on the basic functionality and usage, but the solver needs a workout too. I have been trying to port some of the more difficult (read extreme, stiff, etc) tests from the original library to my module, but I don’t like how they have done it. The GSL test suite simply calculates the result using different step types and comparing that the last values are the same. This is fine for them, but I need to worry that I may have systematic error in passing the Perl closures that represent the Jacobian to the C level solver. This could conceptually pass such a test while still being incorrect. Further I don’t actually have a good test case for extreme or stiff differential equations, notably those that need the Jacobian.

It is for this reason that I am asking those people who solve ODE’s, can you try out my module, and if possible, submit to me some test cases to be included in the test suite. Once I can show that the some cases work, I can feel more comfortable leaning on the underlying GSL test suite to cover the breadth of the solver.

Moving my Perl presence to blogs.perl.org

(*STORE,*TIESCALAR)=
  map{eval"sub{$_}"}qw'map{print&&sleep$|}split//,pop bless\$|++';
tie$t,main;$t="Just another Perl hacker,\n"

I have been blogging for some time over at http://joelslinux.blogspot.com. It was and still will be a blog about Linux and the open source software that I use. I doubt it has many readers, in fact it was mostly for me to remember interesting tidbits should I need them again.

In the past few years I have become quite a Perl enthusiast, doing most of my day-to-day work in Perl and authoring several modules. To get a little deeper into the fray I decided to split my blogging, posting on Perl here in case it may be of use to anyone. I hope people find it informative and I hope to get feedback from those who do (or don’t for that matter).

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.