#!/usr/bin/perl -w # smsforecast.pl - by dual # # Texts the latest forecast ########################### use strict; use LWP::UserAgent; use Net::SMTP_auth; # Declare my @forecast; my $temp; # Feed location my $url = 'http://weather.yahooapis.com/forecastrss?p=90210'; # Create UserAgent object my $ua = LWP::UserAgent->new; # Grab the content and check status my $feed = $ua->get($url); die $feed->status_line . "\n" unless $feed->is_success; # Read in feed content my $content = $feed->content; while ($content =~ /( (Mon - |Tue - |Wed - |Thu - |Fri - |Sat - |Sun - ).+ )/g) { $temp = $1; $temp =~ s/^\s+//; $temp =~ s/
new('SOME.EXCHANGE.SERVER'); $smtp->auth('NTLM', 'USER', 'PASS'); # Send forecast $smtp->mail($ENV{USER}); $smtp->to('PHONE@CARRIER.NET'); $smtp->data(); foreach my $line (@forecast) { $smtp->datasend("$line\n"); } $smtp->dataend(); $smtp->quit;