Uncultured Perl
To circumvent the lack of sendmail on my desktop running Microsoft Windows, I learned to use Net::SMTP;
I remain a novice Perl speaker despite many years of self-teaching.
Anyhow, the result is my third Perl script for blogging:
$ ./blog.pl Usage: blog.pl -p message -t subject $ ./blog.pl -t " unCultured peRL " -p post.htmlI aspire to speak Perl fluently. Here is a snippet of what I said in blog.pl (with the able help of Perltidy) to publish this post. I'm particularly proud of the regex herein.
#! /usr/bin/env perl use strict; use warnings; use Getopt::Std; use Net::SMTP; my %opt; 0 < @ARGV and getopts('p:t:', \%opt) or die "Usage: blog.pl -p message -t subject\n"; my $subject = localtime; exists $opt{p} and -e (my $message = $opt{p}) or die "nonexistent post\n"; if (exists $opt{t}) { # Properly capitalize all words in a title # (i.e., 'cApiTALiZe' becomes 'Capitalize'), # and trim intermediate whitespaces # (i.e., 'I write ' becomes 'I write '). ($subject = $opt{t}) =~ s/(\w+)\s+/\u\L$1 /go; $subject =~ s/^\s+//; # Remove leading whitespaces. $subject =~ s/\s+$//; # Remove trailing whitespaces. } # Code to email…Along the way, I also learned today why it's so easy to spam: unsuspecting servers abound in cyberspace.