jump to navigation

Springcleaning: App::Unix::RPasswd March 25, 2011

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

It’s spring again, so I decided to prepare programs and libraries that are generic enough for CPAN.

App::Unix::RPasswd is the first candidate. App::Unix::RPasswd (remote passwd) is an application for changing passwords on UNIX and UNIX-like servers on a simple, fast (in parallel) and secure (SSH-keys) way. A salt-based retrievable “random” password generator, tied to the supplied server names and date, is included. The generated passwords, unique for each server, can be generated and automatically applied remotely. Because the salt is secret and the correct date string is required, the password for a specific server can only be regenerated by authorized personnel.

Perl 5.10 or higher is required. All recent GNU/Linux distribution have a recent perl (>= 5.10). In case you need it on Solaris 10, you can follow this howto to build a recent Perl (the best option in my view) or get precompiled packages from SunFreeware, Blastwave or OpenCSW.

Get it from CPAN:

cpan App::Unix::RPasswd

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

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

Update: February 17, 2015: This instructions are outdated. Please have a look at https://nxadm.wordpress.com/2015/02/17/build-the-padre-development-tree-using-locallib-on-debianubuntu/

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 ...]

$ ./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: , , , , , ,

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: , , ,

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:
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
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:
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



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


$ which 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…

Install DBD::mysql for Solaris 10 system perl August 13, 2009

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

perlInstalling DBD::mysql on Solaris 10 seems to be less trivial than “cpan DBD::mysql” when you want to use the system-supplied perl (5.8.4) and mysql (4.0.31) installation. Google shows a lot of people asking how to proceed, but surprisingly no answers. Typically, one gets this error at make time:

"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4468: improper member use: com
"dbdimp.c", line 4630: undefined struct/union member: pmysql
"dbdimp.c", line 4653: undefined struct/union member: pmysql
cc: acomp failed for dbdimp.c
make: *** [dbdimp.o] Error 1

To install the module do this:

  1. Install the following Solaris mysql packages (if not already installed): SUNWmysqlr, SUNWmysqlu, SUNWmysqlS, SUNWmysqlt.
  2. Type the following as root:
    cd /usr/sfw/share/src/mysql
  3. Download the tar ball of the modules or, easier, go to your cpan build directory (set at cpan configure time), typically at ~/.cpan/build/DBD-mysql-<VERSION> (already there if you previously tried to install the module with cpan).
  4. Run the makefile with the following arguments (adapt to your own needs if necessary):
    cd ~/.cpan/build/DBD-mysql-<VERSION>
    perl Makefile.PL --libs '-R/usr/sfw/lib -R/usr/sfw/lib/mysql -L/usr/sfw/lib -L/usr/sfw/lib/mysql -lmysqlclient -lz -lposix4 -lcrypt -lgen -lsocket -lnsl -lm' --cflags '-I/usr/sfw/include -I/usr/include -I/usr/sfw/share/src/mysql/include'
  5. Complete the normal installation (make, make test (if you have a test db running), make install).

That’s it.

A bibliography manager for *n*x: JabRef September 16, 2008

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

PhDI have been pretty busy lately (that’s why I haven’t posted a lot). I started writing a PhD dissertation. In order to sort the hundreds of books, articles and original sources I had a quick look at free and open source bibliography applications for *n*x. I was sure I would need to write my own (a light-weight db and a java swing interface) to get the fields I need and have strong search capabilities (SQL). Luckily, I was wrong.


Mount an iso file on Solaris and present it to a zone June 11, 2008

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

When installing software on servers, it is not practical to go the the serverroom (if possible at all), just to insert a cdrom in the machine. Just create an iso with your favorite cd burning software (brasero?), and follow these steps. (more…)

Use external functions/modules in korn shell (ksh) August 7, 2007

Posted by claudio in Uncategorized.
Tags: , , , , , ,
1 comment so far

The korn shell is a great shell to write shell scripts. Some functionalities are really nice. By example, you can write your functions or modules in a separate file and use it within your program. The secret lies in the FPATH environment variable. (more…)

Non hexadecimal ifconfig (Solaris 8, 9 & 10) August 6, 2007

Posted by claudio in Uncategorized.
Tags: , ,
1 comment so far

Solaris is nice, but its ifconfig is pretty annoying. It gives you an hexadecimal netmask.This gives you two choices. One learn to decipher all those f’s or write a ridiculous small wrapper script. Guess what I did. (more…)


Get every new post delivered to your Inbox.

Join 197 other followers