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

Hi, just wondering if there's an existing method for stripping POD documentation out of .pm modules, and leaving the rest of the .pm intact (primarily a space-saving measure, the benefit may be negligable, but I'd like to try it anyway).

I see there are a number of POD-manipulating modules already in CPAN, but I don't see anything directly related to removal.

Thanks for all comments.

Replies are listed 'Best First'.
Re: removing POD docs from modules
by PodMaster (Abbot) on Oct 31, 2002 at 14:05 UTC
    I wrote Pod::Stripper to do just that, strip pod.

    Here's a tip on searching CPAN, look for all distributions containing your subject (like this).

    update:
    I did a little test, took my perl5.8, and removed all html/pod files, and stripped pod out of every .pm, and my perl directory went from about 40mb to about 18mb. None of the modules broke as far as I know , and I ran a few test ( although some heredocs might be missing ;D )

    ____________________________________________________
    ** The Third rule of perl club is a statement of fact: pod is sexy.

      Cool, as an act of pure conceptual art.

      However, I wouldn't want to do any work on your system where perldoc Any::Module returns just No documentation found for "Any::Module".

      BTW, how many cents worth of storage did you save? Less than one (non-free) beer I bet. Unless you're preparing embedded perl for the next-gen chipcards, in which case I'm utterly impressed!

      --
      Cheers Joe ;-)

        However, I wouldn't want to do any work on your system where perldoc Any::Module returns just No documentation found for "Any::Module".
        Then put the stripped POD into a .pod file. In other words: put what you extract from Any/Module.pm into a file Any/Module.pod. It works just as dandy with perldoc.
      Cool, thanks. Actually I did that exact search on CPAN already, and I remember looking at that page, but I guess I missed that reference at the bottom ;) My bad...
Re: removing POD docs from modules
by Abigail-II (Bishop) on Oct 31, 2002 at 13:47 UTC
    I doubt you will accomplish anything serious, but you could do:
    perl -00 -i -ne 'print unless /^=\w/ .. /^=cut/' *.p[ml]

    This might erase legitimate code, but it won't be worse that a POD converter.

    Abigail

Re: removing POD docs from modules
by broquaint (Abbot) on Oct 31, 2002 at 13:54 UTC
    You could do something hackish like
    find /your/perl/lib/path -name '*.pm' | \ xargs perl -ni -e 'print unless /^=\w+/ .. /^=cut/'
    Which works for me, but is *not* a reliable solution. A saner approach would almost certainly involve modules, perhaps subclassing Pod::Simple would do the trick.

    update: or use crazyinsomniac's Pod::Stripper. ahem.
    HTH

    _________
    broquaint

Re: (nrd) removing POD docs from modules
by newrisedesigns (Curate) on Oct 31, 2002 at 13:55 UTC

    What is there to gain in doing this? The amount of space saved is near insignificant. You will be removing a lot of valuable information: technical documentation, requirements, bug info, and author credit.

    If this is really such a hair-splitting issue, why don't you use a text editor to remove the POD from the modules that you see as having excessive documentation?

    John J Reiser
    newrisedesigns.com

      The amount of space saved is near insignificant.

      I'm sure there are many modules where the savings would be neglible, but POD makes up 1/2 of CGI.pm and LWP::UserAgent. If that were true for the majority of modules out there, that's a very significant savings, especially if you're playing in enviroments where space is at a premium (embeded systems, flash cards, install CDs).

      That said, you can save far more space by whittling down a lot of the excess baggage in core distribution than by stripping POD (as touched on in this p5p thread); although doing both should make for a really minimalist Perl install! ;)

          --k.