Changeset 19143
- Timestamp:
- Aug 20, 2008, 3:56:55 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/arclog/arclog.pl (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/arclog/arclog.pl
r19139 r19143 3 3 use strict; 4 4 use warnings; 5 5 6 use vars qw( $VERSION ); 6 7 $VERSION = '0.01'; … … 13 14 use DateTime::Format::Strptime; 14 15 use DBI; 15 16 #use Getopt::Long qw( GetOptions :config auto_help auto_version ); 16 use Email::Send; 17 18 use Getopt::Long qw( GetOptions :config auto_help auto_version ); 17 19 use Pod::Usage qw( pod2usage ); 18 # accept no options 20 21 my ($email); 22 23 GetOptions( 24 'email|s=s' => \$email, 25 ) || pod2usage( 2 ); 26 19 27 pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV; 20 28 … … 34 42 $dbh->do("CREATE TABLE IF NOT EXISTS log(record TEXT, PRIMARY KEY(record))") 35 43 or die "db error"; 44 45 my $errors; 46 my $output; 47 ### 48 if (defined $email) { 49 close(STDOUT); 50 close(STDERR); 51 open(STDOUT, '>', \$output) or die "Can't open STDOUT: $!"; 52 open(STDERR, '>', \$errors) or die "Can't open STDERR: $!"; 53 } 36 54 37 55 # HTTP authentication realm … … 174 192 use warnings; 175 193 } 194 195 my $message =<<END; 196 To: $email 197 From: jhoblitt\@ifa.hawaii.edu 198 Subject: output from arclog.pl 199 200 $errors 201 $output 202 END 203 204 my $sender = Email::Send->new({mailer => 'SMTP'}); 205 $sender->mailer_args([Host => 'hale.ifa.hawaii.edu']); 206 $sender->send($message); 176 207 177 208
Note:
See TracChangeset
for help on using the changeset viewer.
