http://qs321.pair.com?node_id=906580

John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:

Is there a proper way to clean out the files the cpan utility left behind? I see tons of stuff in ~/.cpan/build, and I would have supposed these to be temp files.

Before I just delete stuff, I want to know if it's OK or what. I didn't see any clean-up option for cpan in perldocs, and supersearch for ".cpan/build directory clean" and variations didn't turn up anything.

Thanks.

—John

Replies are listed 'Best First'.
Re: Cleaning out .cpan/build directory
by ikegami (Patriarch) on May 24, 2011 at 22:58 UTC
    You can freely delete what's there. The size of it is limited by o conf build_cache (in MB).
Re: Cleaning out .cpan/build directory
by CountZero (Bishop) on May 25, 2011 at 06:00 UTC
    Cleaning out this directory will not break your Perl-system, but I do check its contents (before the automatic cleaning happens) to see if there are any interesting files in it. Some modules install additional examples and such here. Also looking at some of the tests for the module just installed can give you some extra understanding of its inner working.

    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

Re: Cleaning out .cpan/build directory
by Tux (Canon) on May 25, 2011 at 06:37 UTC

    If you want to clean the stuff that does not influence cpan (the command), you can clean out even more:

    $ cat bin/cpan-clean #!/bin/sh rm -rf $HOME/.cpan/build/* \ $HOME/.cpan/sources/authors/id \ $HOME/.cpan/cpan_sqlite_log.* \ /tmp/cpan_install_*.txt

    Enjoy, Have FUN! H.Merijn

      IIRC, sources (second item) aren't kept if you unset keep_source_where.

      You might also want to remove FTPstats.yml.

      seems like cpan should know to clean build directory ... or use temp for that
        Actually cpan knows how to do that.

        It has a clean command and will clean the .build folder when it gets too big.

        Using the temp area is not such a swell idea since you might want to inspect the files in the .build folder and the temp area has the habit of getting emptied at inopportune moments. At least on Windoze. :(

        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

      Provided that you don't have a hateful .cpan/MyConfig, then you can blow the whole of .cpan away. That's the first thing I do when any of my boxes start running low on disk space.