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

In an attempt to remove all "extra" cpan packages (I'm trying to determine which ones I really need), I accidentally deleted MakeMaker. Now, I can't install any new packages, and I can't install MakeMaker since it has dependencies which I can't install. How do I get around this?

Replies are listed 'Best First'.
Re: accidentally removed MakeMaker.pm
by Corion (Patriarch) on Jan 26, 2011 at 09:52 UTC

    You can download (the appropriate version of) MakeMaker.pm from ExtUtils::MakeMaker (follow the "Source" link). You should make sure that you really have the correct version though :)

      I don't understand the solution? I'm unable to run 'perl Makefile.PL" command for the MakeMaker package. How does your suggestion solve my problem? I'm missing dependencies (for example Cwd.pm) which I can't install without being able to run 'perl Makefile.PL' on those packages?

        I'm not telling you to reinstall the whole package. I'm telling you to download and copy the one missing file to the appropriate location (assuming that you only deleted MakeMaker.pm, as you stated).

Re: accidentally removed MakeMaker.pm
by Anonymous Monk on Jan 26, 2011 at 09:52 UTC
Re: accidentally removed MakeMaker.pm
by marto (Cardinal) on Jan 26, 2011 at 09:56 UTC

    Either restore from backup or download it again from CPAN, ensuring you get the same version which you deleted.

Re: accidentally removed MakeMaker.pm
by moritz (Cardinal) on Jan 26, 2011 at 10:05 UTC
    sudo aptitude reinstall perl-modules

    Worked fine on my machine (Debian Squeeze). Of course I don't know if it will work on yours, since you haven't told us anything about your system.

Re: accidentally removed MakeMaker.pm
by yaelc (Novice) on Jan 26, 2011 at 10:44 UTC
    Thanks for the suggestions. I manually copied in the missing dependencies, and was then able to successfully reinstall ExtUtils-MakeMaker.
Re: accidentally removed MakeMaker.pm
by yaelc (Novice) on Jan 26, 2011 at 10:10 UTC
    running suse linux enterprise 11. I didn't back it up, by the way.

      "I didn't back it up, by the way.

      Well, you know what to do about that in future.

Re: accidentally removed MakeMaker.pm
by stefbv (Priest) on Jan 26, 2011 at 10:08 UTC

    Another option might be to reinstall Perl.

Re: accidentally removed MakeMaker.pm
by locked_user sundialsvc4 (Abbot) on Jan 26, 2011 at 20:17 UTC

    When CPAN downloads a package, it fetches a .gz file in exactly the manner described in the first response.   It is possible to do, by hand, everything that CPAN conveniently automates.   If you, as you did, accidentally mung a package upon which CPAN depends, you need to fix the problem by hand.   CPAN is “very convenient, but not magickal.”

    You can also, of course, reinstall CPAN ... as though you were doing so for the first time.   This will bring in all of the packages upon which CPAN depends.   Then, you simply upgrade CPAN to bring everything up-to-date.   However, since you know exactly what the missing dependency is (and if you are reasonably sure that you did not blast-away something else...), a spot replacement of just this one package should be sufficient.   (If it is not, then you’ll know soon enough.)

    Either way, while you might need to make a pit-stop at the PM Confessional thread over in “Meditations,” this situation is actually just an annoyance, and maybe even a good exercise in practical firefighting.   You are not, actually, “scro-o-o-ooed.”