Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Perl modules confusion

by umeboshi (Acolyte)
on Jun 25, 2009 at 08:56 UTC ( #774643=perlquestion: print w/ replies, xml ) Need Help??
umeboshi has asked for the wisdom of the Perl Monks concerning the following question:

Hi
I am using ubuntu and I think I made a bit of a mess with modules installation and I would like to know how to clean it up. I installed some modules from the synaptic package manager and then tried to install additional modules which cannot be found there.
I installed some using cpan and some (same ones) manually into a self-made local folder. Since the newest versions of some modules are not working properly, I would like to clean up my modules installations and only install those (older versions) I need. So, my questions are:
1) How can I figure out which modules perl is using (from which folder, since I made such a mess)?
2) How can I clean up the modules installations and install older versions of the same modules?
Thanks for any comments, much appreciated!

Comment on Perl modules confusion
Re: Perl modules confusion
by targetsmart (Curate) on Jun 25, 2009 at 09:16 UTC
    I installed some using cpan and some (same ones) manually into a self-made local folder.
    I would like to clean up my modules installations and only install those (older versions) I need
    simple, go to your self-made local folder and check the perl modules installed there, remove/delete the directories/files (modules), which you don't need.

    2) How can I clean up the modules installations and install older versions of the same modules?
    IMO, unless to tell perl that use the self-made local folder as a lib path, perl will still continue to use its own standard lib path that is there in @INC.
    so remove the lib path which indicates your self-made local folder to Perl. It will work as normal and use your older versions of modules. :)


    Vivek
    -- 'I' am not the body, 'I' am the 'soul', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.
      Thanks, that was already VERY informative. That means, if I want to use the exact modules I want I can just temporarily change the lib path to my own folder and do what I need (since apparently I cannot uninstall modules from .cpan). Now, last question. When I print all paths I get:

      $ perl -le 'print foreach @INC'
      /etc/perl
      /usr/local/lib/perl/5.10.0
      /usr/local/share/perl/5.10.0
      /usr/lib/perl5
      /usr/share/perl5
      /usr/lib/perl/5.10
      /usr/share/perl/5.10
      /usr/local/lib/site_perl

      Sorry, I am a total newbie. Which of those paths do I need to change...and more importantly..how?
      Thanks a lot!
        Which of those paths do I need to change...and more importantly..how?
        way 1)
        unshift(@INC, '<path to your self-made local folder where the perl modules are installed>')

        way 2)
        use lib '<path to your self-made local folder where the perl modules are installed>'

        way 3)
        perl -I<path to your self-made local folder where the perl modules are installed>' <your perl program>

        see How do I add a directory to my include path (@INC) at runtime?
        Tutorials is the best place to start in perlmonks, if you are a newbie.
        i started from Categorized Questions and Answers and Tutorials


        Vivek
        -- 'I' am not the body, 'I' am the 'soul', which has no beginning or no end, no attachment or no aversion, nothing to attain or lose.
Re: Perl modules confusion
by Bloodnok (Vicar) on Jun 25, 2009 at 09:20 UTC
    To answer your first question, the way I determine which libraries/modules perl has used, is to dump %INC as the first run-time statement in a script - the result shows the modules loaded and the full path for each.

    A user level that continues to overstate my experience :-))
Re: Perl modules confusion
by stevemayes (Scribe) on Jun 25, 2009 at 09:24 UTC
    Hi,

    I'm using Ubuntu myself and I'm new at Perl so I'm not able to comment on the 'cleaning up' process but I can make two observations.

    Debian has a perlmodule naming system that tries to match (after a fashion) the module names, by sticking a lib in front of the it. e.g. DBD::mysql is libdbd-mysql-perl

    Apt-cache search searches your repositories and you can use this to find what modules are available, e.g.

    apt-cache search libdbi

    outputs the following and has allowed me to guess at the modules I needed

    libdbi-perl - Perl5 database interface by Tim Bunce libdbd-freetds - Freetds database server driver for libdbi libdbd-mysql - MySQL database server driver for libdbi libdbd-pgsql - PostgreSQL database server driver for libdbi libdbd-sqlite - SQLite database driver for libdbi libdbd-sqlite3 - SQLite3 database driver for libdbi libdbi-doc - DB Independent Abstraction Layer for C -- documentation libdbi-ruby - Database Independent Interface for Ruby libdbi-ruby1.8 - Database Independent Interface for Ruby 1.8 libdbi0 - Database Independent Abstraction Layer for C libdbi0-dev - DB Independent Abstraction Layer for C -- development f +iles libdbicx-testdatabase-perl - Create a temporary database from a DBIx:: +Class::Schema libdbix-abstract-perl - DBI SQL abstraction libdbix-class-datetime-epoch-perl - Automatic inflation/deflation of e +poch-based DateTime objects for DBIx::Class libdbix-class-htmlwidget-perl - Like FromForm but with DBIx::Class and + HTML::Widget libdbix-class-perl - Extensible and flexible object <-> relational map +per libdbix-class-schema-loader-perl - Dynamic definition of a DBIx::Class +::Schema libdbix-contextualfetch-perl - Add context aware fetches to DBI libdbix-datasource-perl - Database-independent create and drop functio +ns libdbix-dbschema-perl - Database-independent schema objects libdbix-easy-perl - Easy to Use DBI Interface libdbix-fulltextsearch-perl - Indexing documents with MySQL as storage libdbix-password-perl - Perl module for creating a global password fil +e for DB passwords libdbix-profile-perl - DBI query profiler libdbix-recordset-perl - Perl extension for DBI recordsets libdbix-searchbuilder-perl - Encapsulate SQL queries and rows in simpl +e perl objects libdbix-sequence-perl - A simple SQL92 ID generator libdbix-xml-rdb-perl - perl module for creating XML from a DBI datasou +rce libdbix-xmlmessage-perl - perl module for exchanging XML messages betw +een DBI data sources

    The debian team do say if you can't find ask and they'll build. I'm starting to think I might 'roll my own' and learn the CPAN way, but was going to discuss it on Perlmonks first.

    As I say, I'm a noob and I had similar issues re modules but feel free to disregard my comments and definitely pay attention to what others suggest here (especially if it contradicts what I've said - chances are it's me that's in error).

    I've had this node pointed out to me by Elisheva : http://www.perlmonks.org/?node_id=753416 it discusses debian/CPAN in detail

      I also just started using Perl with Ubuntu. I had been used to installing modules from CPAN, but after a couple of failed builds (involving some modules with C code which reacted badly to my AMD_64 architecture) I decided to give the Ubuntu package manager a shot. It's definitely a nicer interface, rather like Activestate's Perl Package Manager -- you just install the pre-compiled binaries, with no worries about builds failing.

      However: those nice pre-compiled binaries are not guaranteed to be built from the latest source available on CPAN, and they are not guaranteed to be compatible with whatever modules you've downloaded from CPAN. I had been using Hardy Heron, and ran into rather painful version compatibility issues with some of the SMTP, IMAP, and SSL modules. Upgrading to Jaunty Jackalope fixed the issues, albeit at some cost.

      Bottom Line: The Ubuntu package manager is nice for installing pre-compiled Perl modules, but BE CAREFUL mixing those modules with modules from CPAN -- there may be version compatibility issues.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://774643]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2014-08-30 12:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (293 votes), past polls