bhushanQA has asked for the wisdom of the Perl Monks concerning the following question:

Just wanted to know How to check DBI module version from CPAN and how to upgrade the same from CPAN Please specify the commands which can work from Linux CPAN.

  • Comment on How to check DBI module version from CPAN and how to upgrade the same from CPAN

Replies are listed 'Best First'.
Re: How to check DBI module version from CPAN and how to upgrade the same from CPAN
by marto (Cardinal) on Jun 23, 2015 at 08:38 UTC

    Check which version of DBI you have:

    cpan -D DBI

    Example output:

    Done! DBI ---------------------------------------------------------------------- +--- (no description) T/TI/TIMB/DBI-1.633.tar.gz D:\perl\perl\vendor\lib\DBI.pm Installed: 1.631 CPAN: 1.633 Not up to date Tim Bunce (TIMB) Tim.Bunce@pobox.com

    Note that the installed version and cpan verison are listed, and it's pointed out where the installed module is not up to date. Just install the new version:

    cpan DBI

    Check out of date modules:

    cpan -O
Re: How to check DBI module version from CPAN and how to upgrade the same from CPAN
by kcott (Archbishop) on Jun 23, 2015 at 08:59 UTC

    G'day bhushanQA,

    To find out what version you're currently using:

    $ perl -le 'use DBI; print $DBI::VERSION' 1.633

    To find out what versions are currently available on CPAN, use http://search.cpan.org/ and enter DBI.

    Upgrading on Linux is not really in my sphere of expertise. It will depend on which Linux you're using: the command may be yum, apt-get or possibly others — I'm sure other monks will provide a much better answer for this particular task.

    If you're using your own (i.e. non-system) Perl, the cpan utility is provided with the core distribution. See its documentation for usage.

    Another popular utility for installing CPAN modules is cpanm. I don't use this, so I won't comment further — again, other monks may provide more information about it.

    -- Ken

Re: How to check DBI module version from CPAN and how to upgrade the same from CPAN
by Corion (Patriarch) on Jun 23, 2015 at 08:40 UTC

    This will print the installed version of DBI:

    perl -MDBI -e 'die $DBI::VERSION'

    This will install the current version from CPAN:

    cpan DBI

    If you are not using your own, self-compiled Perl, I recommend you use the vendor packaging system to install Perl modules instead of using CPAN. Not doing so will result in problems with binary compatibility if your vendor upgrades or downgrades module versions for compatibility reasons with their own tools.