#! /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.html', 'http://www.theonion.com/onion3402/he_is_no_good_3402.html'); my @smoove = ( 'http://www.theonion.com/onion3102/treat_u_right_3102.html', 'http://www.theonion.com/onion3114/think_of_you_3114.html', 'http://www.theonion.com/onion3202/bringiton.html', 'http://www.theonion.com/onion3213/let_us_freak_3213.html', 'http://www.theonion.com/onion3313/get_smooved_3313.html' ); 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(/\/, $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(/\/, $retval)); } } my @smoove_text; foreach my $t (@text) { next if ($t =~ m/(img src|script|\{|\})/); next if ($t eq ""); $t =~ s/\"\;/ /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 "$!";