1 #!/usr/bin/perl
 2 
 3 use strict;
 4 use warnings;
 5 
 6 use Data::Dumper;					# Debugging
 7 use DateTime::Format::DateManip;	# Date Parsing
 8 use MIME::Lite;						# Build & Send Emails
 9 
10 #
11 # Email Configuration
12 my %email = (
13 	Subject		=> 'Testing the MIME::Lite Interface',
14 	To			=> 'Brad Lhotsky <lhotskyb@mail.nih.gov>',
15 	From		=> 'MIME::Lite <lhotskyb@mail.nih.gov>',
16 );
17 
18 #
19 # Some Data
20 my %dates = (
21 	tomorrow 				=> '',
22 	today					=> '',
23 	'next tuesday'			=> '',
24 	'last friday at 5pm'	=> '',
25 );
26 
27 #
28 # Use DateTime::Format::DateManip to understand them
29 foreach my $dateStr (keys %dates) {
30 	my $dt = DateTime::Format::DateManip->parse_datetime($dateStr);
31 	$dates{$dateStr} = $dt->datetime;
32 }
33 
34 #
35 # Build the message
36 my $msg = MIME::Lite->new(
37 	%email,
38 	Type	=> 'TEXT',
39 );
40 
41 #
42 # Simple Email body that dumps our parsed dates
43 my $body = Dumper ( \%dates );
44 $msg->data( $body );
45 
46 #
47 # Print the Message to the screen
48 print Dumper( $msg );
49 
50 #
51 # Send the message;
52 #$msg->send();
53 


syntax highlighted by Code2HTML, v. 0.9.1