Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Ladies, gentlemen, and others, today I (proudly?) introduce you to the first invention produced by Jason's Laboratory of Useless Perl Things. . . the Spudgun!

You'll laugh, you'll cry, or perhaps even hurl at this most wonderous (?) thing. Use it to annoy your spouse, boss, coworkers, family, and friends. All you have to do is pass the Spudgun your e-mail address, your name, the e-mail address of your victim, and the name of your victim, and the Spudgun will do the rest! Having a boring workday? You can even spud yourself!

All that peppy mumbo-jumbo aside. . . this is actually the Perl adaptation of a C-program I wrote some time ago to illustrate some of the cool things that can be done programatically with strings. Once I wrote it in C, the Spudgun seemed potentially far more beautiful thing in Perl, and so I ported it.

Replace $smtp with the name (or IP) of the mailserver that you want to use to send the Spudgun output. You can tweak $max_spuds and $rand_max to your preference. . . raise the number of spuds though and you can really tick off some of your loved ones ;) @how, @where, and @what can also be added to. . . In fact, if anyone comes up with some clever ones that I missed, I'd be interested in hearing them =)

For your spudding convenience, I wrapped some CGI code around this and posted the result to here for you to play with.

Thank you for letting me waste your time ;) Happy spudding to you!

MrCromeDome

#!/usr/bin/perl use strict; use warnings; use Mail::Sender; use Email::Valid; # Get some parameters my ($from_email, $from_name, $to_email, $to_name) = @ARGV; # Die if we don't have valid e-mail addresses die "From e-mail is not a valid address!" unless Email::Valid->address +($from_email); die "To e-mail is not a valid address!" unless Email::Valid->address($ +to_email); # SMTP server my $smtp = "your.mailserver.com"; # Spud settings my $max_spuds = 50; my $rand_max = 60000; my @how = qw(smashed shot bopped hit splattered slammed nailed creamed + bonked smacked clobbered); my @where = qw(face hand thumb arm gut eye leg chin gut butt skull hea +d ass groin nads boob ear toe foot); my @what = ("a potato", "a flying spud", "a high velocity spud", "a rocketing potato", "a deadly spud", "a potato of death", "the Mother of All Potatoes", "a hot potato", "a sweet potato"); # What message are we sending? my $message = "$to_name, $from_name has just shot you with a spudgun!! +!\n\n"; # Seed the random number generator srand($$|time); # Fire in the hole! my $times = 1 + rand($rand_max) % $max_spuds; for(my $which = 1; $which <= $times; $which++) { $message .= sprintf("You get %s in the %s by %s.\n", $how[rand($rand_max) % (scalar @how)], $where[rand($rand_max) % (scalar @where)], $what[rand($rand_max) % (scalar @what)]); } $message .= "\nYour friend,\nMrCromeDome at perlmonks.org\n"; # E-mail the damage (new Mail::Sender)->MailMsg( { smtp => $smtp, from => $from_email, to => $to_email, subject => "You've just been spudded!", msg => $message }); # Generate a response message print "Thank you, $from_name, for using the spudgun. Happy spudding t +o you!\n";

In reply to The Spudgun by MrCromeDome

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-03-28 21:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found