Hide a package name from PAUSE

When you upload a distribution, PAUSE examines it so it knows what to put into the index files that the various CPAN clients use to translate a namespace into a distribution name. PAUSE doesn’t want to run any code since anyone can upload anything, so it does a very simple minded analysis in PAUSE::pmfile. It goes through the file one line at a time. The most complicated work it does remembers if it is in POD or not. For non-POD lines, it checks this regex:

        if (
            $pline =~ m{
                      (?: $ | [\}\;] | ($version::STRICT) )
                    }x) {

The value in $pline is a single line, so PAUSE will only find a package statement that is completely on the same line. If your package statement is not on one line, PAUSE won’t see it:

package # hide from PAUSE

There are a couple reasons you might want to do this. You might insert or replace code in a package that you don’t own, perhaps to fix it. I talk about this sort of fix in Mastering Perl, although I don’t show this PAUSE trick.

Leave a Reply

Your email address will not be published. Required fields are marked *