Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

profanity here?

by PodMaster (Abbot)
on Jun 09, 2003 at 10:15 UTC ( #264285=snippet: print w/ replies, xml ) Need Help??

Description: 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.
# ~~~~~~~~~~~~~~~~~~~~^^^^^

Comment on profanity here?
Download Code
Re: profanity here?
by benn (Priest) 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."

Back to Snippets Section

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: snippet [id://264285]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2014-09-18 08:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (109 votes), past polls