jump to navigation

Build Padre svn easily with perlbrew and cpanm December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , , , , ,
2 comments

Update: January 7, 2014

Because of the fast pace of the development of Padre, the/a Perl IDE, it’s may be nice to run a bleeding edge version. Or even better, as Padre itself is written in Perl, you may like to have a look at the sources and maybe contribute some code or help with the translations.

Follow this howto to build the latest Padre from source with perlbrew and cpanm. This way, you’ll get started in no time and you won’t even touch your system Perl installation (cleanup is just a “rm -rf” away…).

1. Install perlbrew and cpanm. You can follow my howtos here: perlbrew (important: compile perl with thread support!), cpanm.

2. Install subversion (to check out the code), the compilations utils (gcc, g++, make) and the gtk2 header files. On Debian/Ubuntu:
$ sudo apt-get install subversion build-essential libgtk2.0-dev libghc-readline-dev

An interesting -but not required- shortcut is to install the Padre release in your distribution to get binary dependencies: $ sudo apt-get install padre

3. Checkout Padre from svn (I chose to install the sources under ~/Code/Padre, adapt accordingly to your standards):
$ mkdir -p ~/Code/Padre && cd ~/Code/Padre
$ svn co http://svn.perlide.org/padre/trunk

4. Install the modules that Padre needs before building the IDE.
$ cpanm Parse::Yapp Module::Install Locale::Msgfmt Alien::wxWidgets
[... lots of output ...]

$ cpanm Wx --force
[... lots of output ...]

(Wx seems to have a circular test. Force the install in the meantime.)

5. Build Padre.
$ cd ~/Code/Padre/trunk/Padre

Install the dependencies (thx to Perigrin for the simplified method):
$ cpanm --installdeps .
[... lots of output ...]

$ perl Makefile.PL
[... some output ...]

As said, development is happening fast on Padre and new releases of (external) CPAN modules are required often (some even updated by the authors in order to provide the functionality Padre needs). If a new version of a module is needed that is not yet on your cpan mirror, run cpanm (–mirror) again with a more up-to-date mirror. Run “perl Makefile.PL” again afterwards.
$ make
[... lots of output ...]

$ make test
[... lots of output ...]

6. Install padre (in the active perlbrew dependant directory) or just run the development version without installing it (including all changes to the code even after installation):
$ make install
[... lots of output ...]

or
$ ./dev.pl -a

Here it is:

EDIT: ZenoG’s article is a good followup post giving an step-by-step description of bug fixing is Padre.

App::cpanminus: zero-conf CPAN client December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , , , , ,
2 comments

App::cpanminus (cpanm) is an other great example of programs inscribed in the Modern Perl philosophy. From the CPAN page of the program:

cpanminus is a script to get, unpack, build and install modules from CPAN.

Why? It’s dependency free, requires zero configuration, and stands alone. When running, it requires only 10MB of RAM.

Zero configuration sounds excellent considering the rather steep learning of the (great!) CPAN tools (the cpan command line utility CPAN.pm and CPANPLUS) for new Perl users.

How does it work? Let try a big module with a lot of dependencies and C++ compiling activity. Install the application through cpan if configured (or with one of the standalone installations options):

$ cpan App::cpanminus
[...]

$ cpanm Moose
--> Working on Moose
Fetching http://search.cpan.org/CPAN/authors/id/D/DR/DROLSKY/Moose-1.21.tar.gz ... OK
Configuring Moose-1.21 ... OK
==> Found dependencies: Try::Tiny, Package::DeprecationManager, Test::Requires, Class::MOP, Sub::Exporter, Test::Fatal, Sub::Name, Data::OptList, Params::Util, List::MoreUtils, Task::Weaken
--> Working on Try::Tiny
[...]
Building and testing Moose-1.21 ... OK
Successfully installed Moose-1.21

$ perl -MMoose -e1

No errors. The modules (and their dependencies) installed just fine. Wow.

Get the latest Perl release with perlbrew December 10, 2010

Posted by claudio in Uncategorized.
Tags: , , ,
8 comments

Updated: January 7, 2014.

Sometimes you want to leave your system Perl installation in peace and don’t really want to mix the system supplied Perl Modules and newer versions from CPAN. Or you want to use CPAN without sudo and without using PERL5LIB or local::lib. Or you may to test your code on older Perl releases. Or you simply can’t wait to use that shiny latest Perl release.

Good news. Perlbrew is a very nice addition to the “Modern Perlwave resulting in a language and community revival of Perl 5 (that seems to have revitalized Perl 6 at the same time).

From the perlbrew CPAN page:

perlbrew is a program to automate the building and installation of perl in the user’s HOME. At the moment, it installs everything to ~/perl5/perlbrew, and requires you to tweak your PATH by including a bashrc/cshrc file it provides. You then can benefit from not having to run ‘sudo’ commands to install cpan modules because those are installed inside your HOME too. It’s a completely separate perl environment.

Here you’ll find how to use and customize perlbrew on a Debian/Ubuntu or Solaris installation. You don’t need g++ for perlbrew, but some modules from CPAN may need it later:

$ sudo apt-get install g++ curl

In case you use Solaris, install the Sunstudio compiler and make sure make and ar are in your PATH:
$ export PATH=/usr/bin:/usr/sbin:/opt/SUNW/spro/bin:/usr/ccs/bin

$ mkdir ~/lib

$ curl -LO http://xrl.us/perlbrew
[...]

$ chmod +x perlbrew

The directory ~/perl5/perlbrew will contain all install perl executables, libraries, documentations, lib, site_libs. In case you don’t like the default, you can change it with the PERLBREW_ROOT shell variable. Change , and accordingly to your installation.

$ export PERLBREW_ROOT=~/lib/perlbrew

$ ./perlbrew install

The perlbrew is installed as:
/home/user/lib/perlbrew/bin/perlbrew
You may trash the downloaded /home/user/tmp/perlbrew from now on.
Next, if this is the first time you install perlbrew, run:
/home/user/lib/perlbrew/bin/perlbrew init
And follow the instruction on screen.

$ rm perlbrew

$ ~/lib/perlbrew/bin/perlbrew init

Perlbrew environment initiated, required directories are created under
/home/user/lib/perlbrew
Well-done! Congratulations! Please add the following line to the endof your ~/.bashrc.
After that, exit this shell, start a new one, and install some freshperls:
perlbrew install perl-5.12.1
perlbrew install perl-5.10.1

For further instructions, simply run:
perlbrew
The default help messages will popup and tell you what to do!
Enjoy perlbrew at $HOME!!

$ echo "source /home/$USER/lib/perlbrew/etc/bashrc" >> ~/.bashrc

$ source ~/.bashrc

You can install new perl releases by typing by example “perlbrew install perl-5.12.3″. However, it may be a good idea to enable some features on the new compiled perl (mostly taken from the Ubuntu/Debian compile), specially the enabling of threading needed by a lot of perl programs (e.g. Padre):

$ perlbrew install perl-5.12.3 -Dusethreads -Duselargefiles  -Dcf_by="Your_name_here" -Dcf_email="Your_email@here"

If you run a 64-bit OS:  -Duse64bitall

Handy on Debian/Ubuntu: -Dpager=/usr/bin/sensible-pager

Output:

[...]

Installed perl-5.12.3 as perl-5.12.3 successfully. Run the following command to switch to it: perlbrew switch perl-5.12.3

If you have several perl releases installed , you can choose the main perl by typing:

$ perlbrew switch perl-5.12.3

$ which perl

/home/claudio/lib/perlbrew/perls/perl-5.12.3/bin/perl

$ which cpan

/home/claudio/lib/perlbrew/perls/perl-5.12.3/bin/cpan

$ perl -v

This is perl 5, version 12, subversion 3 (v5.12.3) built for x86_64-linux-gnu-thread-multi
Copyright 1987-2010, Larry Wall
Perl may be copied only under the terms of either the Artistic License or theGNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found onthis system using “man perl” or “perldoc perl”.  If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.

A shiny new Perl to play work with…

Compile the latest version of Perl on Solaris 10 September 14, 2010

Posted by claudio in Uncategorized.
Tags: , , , ,
add a comment

Updated on Sept 09 2010.
Like on all UNIX operating systems, Solaris 10 supplies a Perl installation and it even adds its own modules in the Solaris namespace (yeah!). However, the version installed is 5.8.4, released on April 21, 2004 (boo!). Nowadays – in the Modern Perl’s times – you should use something as handy as App::perlbrew to install new versions of perl from source. As often in a corporate environment, however, it’s not always possible to directly reach the CPAN mirrors through perlbrew (proxy support is a work in progress). At the same time, it seems that a lot of people have trouble answering to the Configure questions to get the perl binary they need (at least 64-bit optimization and threads). This is how I compile perl on Solaris 10.

  1. Make sure you have the needed Solaris packages installed to compile C and C++ code. This is a good starting point. You can install the defaul Solaris compiler Sunstudio or gcc (provided as a SFW package in the installation media). Make sure the directories containing these binaries are in you PATH and /usr/ucb is not.
  2. Download the source, gunzip and untar it, cd to the directory.
  3. Run:
    ./Configure -ders -Dcc=cc -Dusethreads -Duseithreads -Ud_sigsetjmp -Uinstallusrbinperl -Ulocincpth= -Uloclibpth= -Duse64bitall -Ud_strerror_r -Ud_signbit -Duselargefiles -Dprefix=/opt/perl-5.12.2 -Dprivlib=/opt/perl-5.12.2/lib -Darchlib=/opt/perl-5.12.2/lib -Dsiteprefix=/opt/perl-5.12.2/site -Dsitelib=/opt/perl-5.12.2/site/lib -Dsitearch=/opt/perl-5.12.2/site/lib -Dman1dir=/opt/perl-5.12.2/share/man/man1 -Dman3dir=/opt/perl-5.12.2/share/man/man3 -Dsiteman1dir=/opt/perl-5.12.2/site/share/man/man1 -Dsiteman3dir=/opt/perl-5.12.2/site/share/man/man3 -Dsed=/usr/bin/sed -Duseshrplib -Dcf_by="<Your name here>" -Dcf_email=<Your e-mail here>
    (Change <…> with valid vales. Also, if you run Configure more than once, make sure to remove config.sh and not rename to something starting with config.sh. As an alternative you can remove the Perl source dir altogether and untar the source file again.)
  4. make
    In this step, when using the Sun Studio compiler, make can be replace by the faster (parallel) “dmake”.
  5. make test
    Update: there is a small bug concerning the following tests:

    Failed 5 tests out of 1747, 99.71% okay.
    ../cpan/Archive-Extract/t/01_Archive-Extract.t
    ../cpan/IO-Compress/t/010examples-bzip2.t
    ../cpan/IO-Compress/t/010examples-zlib.t
    ../cpan/IO-Compress/t/cz-05examples.t
    ../cpan/Test-Harness/t/regression.t

    When you run the test by hand they are OK, so they can be safely ignored (thanks people on #p5p).

  6. make install

NB: if you are creating a package instead of installing, you will need the switch -Dinstallprefix

Happy Recent Perl!

Follow

Get every new post delivered to your Inbox.

Join 142 other followers