Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Grepping the whole of CPAN

by dmitri (Priest)
on Jul 12, 2007 at 01:33 UTC ( #626124=perlquestion: print w/replies, xml ) Need Help??
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 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 (Pope) 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 (Monsignor) 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/

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://626124]
Approved by shigetsu
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (10)
As of 2016-10-27 18:11 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (368 votes). Check out past polls.