in reply to St. Valentine's Day preperation script

This is nice - but wouldn't it be better to personalize it more? You could take phrases from previous loving emails exchanged by the couple.. or phrases from love letters from others.. or just quote Smoove B.
#! /usr/bin/perl -w use LWP::UserAgent; use Carp; use Mail::Sendmail; use strict; my $mood = shift || 'smoove'; # you my $self = 'Monk'; my $email = 'monk@monastery'; # her my $chicks_name = 'Chick'; my $her_email = 'chick@hermail.com'; my @subjects = ( "hey babe...", "a short message from your lover...", "just wanted to say hi...", "oh I love you...", ); my $ua = LWP::UserAgent->new(); $ua->agent("MySmooveB/0.1 "); my @doghouse = ( 'http://www.theonion.com/onion3120/pick_up_phone_3120 +.html', 'http://www.theonion.com/onion3107/baby_please_3107.h +tml', 'http://www.theonion.com/onion3402/he_is_no_good_3402 +.html'); my @smoove = ( 'http://www.theonion.com/onion3102/treat_u_right_3102.h +tml', 'http://www.theonion.com/onion3114/think_of_you_3114.ht +ml', 'http://www.theonion.com/onion3202/bringiton.html', 'http://www.theonion.com/onion3213/let_us_freak_3213.ht +ml', 'http://www.theonion.com/onion3313/get_smooved_3313.htm +l' ); my @text; if ($mood =~ /d/) { # you're in the doghouse foreach my $x (@doghouse) { my $req = HTTP::Request->new(GET => "$x"); my $retval = $ua->request($req)->as_string; push (@text, split(/\<p\>/, $retval)); } } else { # default, is smoove foreach my $x (@smoove) { my $req = HTTP::Request->new(GET => "$x"); my $retval = $ua->request($req)->as_string; push (@text, split(/\<p\>/, $retval)); } } my @smoove_text; foreach my $t (@text) { next if ($t =~ m/(img src|script|\{|\})/); next if ($t eq ""); $t =~ s/\&quot\;/ /g; $t =~ s/\<(\/)?i\>/ /g; $t =~ s/\&(\S*)\;//g; $t =~ s/\<\/p\>//g; $t =~ s/\//\n/g; $t =~ s/\./\.\n/g; $t =~ s/Smoove B/$self/g; my @lines = split(/\n/, $t); foreach my $l (@lines) { $l =~ s/^\s*//; next if ($l eq "."); next if ($l eq ""); push (@smoove_text, $l); } } my %mail = ( To => $her_email, From => $email, Subject => $subjects[rand($#subjects)], Message => $smoove_text[rand($#smoove_text)] ); sendmail(%mail) || warn "$!";
Sure, its extra effort. But no effort is too much for my baby. Smoove out.

Replies are listed 'Best First'.
Re: Re: St. Valentine's Day preperation script
by sschneid (Deacon) on Jan 28, 2003 at 18:15 UTC
    Oh dear, that is absolutely the most beautiful use of perl I have ever seen. Baby.