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

Dear Brethren,

being the maintainer of the Perl part of ctags, I get very interesting bug reports from time to time, for instance this one.

I would consider the snippet of code below a very rare (read: nonexistant) occurence. I mean, who would use __END__ as the terminator for a here-to document? The best way to test my assumption would be to grep the whole of CPAN...

Question: what is the best way to "grep" CPAN?

Thank you,
  - Dmitri.

Snippet from the bug report:

package a; sub abc { print "abc"; } sub def { print <<__END__; def __END__ } sub ghi { print "ghi"; } 1;

Replies are listed 'Best First'.
Re: Grepping the whole of CPAN
by jasonk (Parson) on Jul 12, 2007 at 02:02 UTC

    http://www.google.com/codesearch/. The best part is that you don't even have to limit it to CPAN, just use "lang:perl" as part of the search...


    We're not surrounded, we're in a target-rich environment!
      Thank you! I did not know about this resource. It works beautifully.

      And, apparently, there are people who use __END__ for here-to docs...

Re: Grepping the whole of CPAN
by Corion (Patriarch) on Jul 12, 2007 at 06:30 UTC

    Also, if you have a CPAN::Mini mirror locally, you can apply diotalevi's patch to File::Next and then use ack to grep through the archives of your CPAN mirror. Likely, Google code search is quicker though...

Re: Grepping the whole of CPAN
by holli (Abbot) on Jul 12, 2007 at 11:00 UTC
    Show me a Perl programmer who does that and I'll do something evil to him
    That was exactly my thoughts. __END__ is a reserved word and you don't use a reserved word as a delimiter. period.

    (It works with other reserved words, but that's not the point.)


    holli, /regexed monk/