30 April 2008

Upgrade manually an installed perl module

When an application requires a minimum perl module version which is not provided by installed RPM, it can be upgraded manually.
For instance, it is the case of amavis (see create a full and secured emails server), when upgrading some perl rpm packages (perl-CPAN for instance).

To upgrade CPAN perl module manually, opens a perl shell:
perl -MCPAN -e shell

Then request the "install" of the newest available perl module version. For instance:
install File::Temp

Define the current version of a perl module

To get the current version of an installed perl module, the following command can be used:
perl -le 'use MODULE_NAME; print MODULE_NAME->VERSION'
With MODULE_NAME the name of the wished perl module.

For instance with File::Temp it gives:
perl -le 'use File::Temp; print File::Temp->VERSION'

25 April 2008

Get the list of gcc defined macro after preprocessing

It various situation, it is very useful to get the list of all defined maco after gcc preprocessing.
Particularly when porting C/C++ source code to another OS/Architecture to know what macro to use to identify it.

A simple way is to use gcc with the following options:
-E to end after preprocessing step,
-dM to print all defined macros.

For instance to known the "default" macros, use those options with a simple source code file "test.c" defining a main function:
gcc -E -dM test.c