Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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.


    $ 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.

use File::Find();
use Regexp::Common qw /profanity/;

use strict;
use warnings;

@ARGV = '.' unless @ARGV;

        wanted => \&wanted,
        no_chdir => 1,


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 (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
    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.


    "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.


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

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (12)
As of 2016-09-26 17:32 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (485 votes). Check out past polls.