Sometimes profanity creeps into my work code, and I'd really like not to publish it (especially on CPAN). That's why I whipped this snippet up.

Usage:

    $ perl profanity optional dirpaths . is searched by default

    $ perl profanity
    ./profanity : 42 : turds

This proggie will probably never make use of the Pod::Usage/Getopt::Long combo.
#!/usr/bin/perl use File::Find(); use Regexp::Common qw /profanity/; use strict; use warnings; @ARGV = '.' unless @ARGV; File::Find::find( { wanted => \&wanted, no_chdir => 1, }, @ARGV ); exit(0); sub wanted { isProfane( $_ ) if -r $_ and -T _; } sub isProfane { my( $file, $fh ) = @_; open $fh, '<', $file or die "couldn't read $file : $!"; while( readline $fh ){ for my $w( /$RE{profanity}{-keep}/g ){ print "$file : $. : $w\n"; } } close $fh; } # Soylent Cowflop is people, people! # That's probably why turds make great manure. # ~~~~~~~~~~~~~~~~~~~~^^^^^

Replies are listed 'Best First'.
Re: profanity here?
by benn (Vicar) on Jun 09, 2003 at 10:37 UTC
    That's ******* great - what a ******* good idea you clever ****** - it'd save my ******* *** being whipped every ******* time my ******* code goes out of the ******* door...

    :) Cheers, Ben.

Re: profanity here?
by Aristotle (Chancellor) on Jun 09, 2003 at 12:04 UTC
    If you want to have some fun, run this against the Linux sources. ;-)

    Makeshifts last the longest.

Re: profanity here?
by shotgunefx (Parson) on Jun 09, 2003 at 19:44 UTC
    PodMaster++
    My code used to be peppered like it had Tourettes. The more problematic the job, the worse it got. It was a real hard habit to break but worthwhile.

    I was always afraid of having a client tell me they got an error like "F****** c**t sh*t: $!" because I missed removing one.

    -Lee

    "To be civilized is to deny one's nature."
      F****** c**t sh*t: $!

      Ok, I've never been very good at cryptic crosswords words but I'm guessing "Firearm colt shot". You're not one of those Geeks with Guns are you?

        Pretty weird guess for a thread on profanity :P
        But to answer, nope, no longer own any firearms.

        -Lee

        "To be civilized is to deny one's nature."