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

I am new to Perl and Linux as well. I installed Ubuntu 10.04 LTS. I was checking CPAN modules & I was able to check the versions of few CPAN modules and one of them didn't return the version for Time::Local I tried to install it manually. After that I ran some cpan command based on some research on internet. I have no idea what happened. It asked me a few questions, I choose defaults and now I am in trouble. When I try to use the per -e 'use FileHandle....command as per doc for any CPAN module, it just returns blank. I know that I have done a mistake somewhere, but not sure what I did not nor what the mistake is. All I want now is for the system to just get back to its normal, and the CPAN thing as how it was with fresh install of Ubuntu. I tried reinstalling perl, but it says perl latest version is there. Don't know how to get the CPAN thing like the way it was with fresh Ubuntu install. Any help will be appreciated. Kishore

Replies are listed 'Best First'.
Re: cpan problem
by CountZero (Bishop) on Dec 27, 2010 at 10:33 UTC
    Generally, it is considered a bad idea to muck about with the system-installed Perl on any Linux-system. There are probably a lot of other applications that need this Perl to work. Even upgrading to newer versions of the existing modules is not guaranteed to be safe.

    If you need a more modern Perl (I seem to remember Ubuntu 10.04 LTS comes with some version of Perl 5.10) or need to update some modules, best to install a second version of Perl in your private directories and explicitly run this version for your own needs and leave the system Perl "as is".

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      In futherance of this, perlbrew is an excellent tool which facilitates installing and managing Perl installations (eg, switching between working versions).
Re: cpan problem
by Marshall (Canon) on Dec 27, 2010 at 12:22 UTC
    I am not sure what went wrong at the start. You said, "one of them didn't return the version for Time::Local".

    Backing up...I suspect that your *nix system installed Perl 5.10.X although a newer version of Perl might be there, I think it is unlikely. When you get things working again, prompt>perl -V will tell you the version info. Nowadays all *nix systems come with some version of Perl already installed and many programs will just assume that "Perl is there".

    You are new to Perl and and may not know that Perl comes with a whole lot of modules as part of its "core", Time::Local is one of those modules. See: Perl 5.10.1 Core Modules - T index. Navigate around to see the many other core modules. So Time::Local would have already been installed. That's why your statement that I quoted above confuses me.

    I don't know how to get you "back to where you were to start with" because for one thing, I'm not really sure where you are! Let's say that disaster happens and you have to "start over" with a re-install...

    I would recommend that you create a user account and use that account for installing further modules...if you need to. You do have the root password, but as you've seen that can get you into trouble! If you "mess up" as a user, worse case, you just delete that account and re-create it to start over. Being sys admin is cool, but dangerous.

    I recently installed a local Perl lib with extra modules on a Linux student account. I explained what I did at this node: Re^3: Linux::Inotify2, adding sub-dirs to watches event-triggered.... Some tweaking will be required, but once you get this working, you can't "shoot yourself in the foot". Read the link that my post references in the tutorials. The ".cpan" directory is a "hidden file". You may just need to zap that thing to get you "back to square one".

    I doubt that as a Perl beginner that you will need greater than Perl 5.10 for some time. I wouldn't worry about getting the "latest and greatest". If you just install additional modules in your user account, for the version of Perl that your system is using, I think you'll be fine.

    Hope this helped.

    Update: I re-read the original post again because perhaps I missed something. I'm not sure that anything at all is "broken". I could have just spewed out a bunch of advice that just doesn't matter at all! If you make a simple hello world program like this and it runs, then your Perl is working! "use Time::Local;" should not print anything unless there is an error.

    #!/usr/bin/perl use warnings; use strict; use Time::Local; print "hello world\n";
Re: cpan problem
by Anonymous Monk on Dec 27, 2010 at 05:57 UTC
    perl -e'use Filehandle;' shouldn't print anything. Exactly what isn't working?