Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

tiny cleanups

  • Loading branch information...
commit a8e7981efe26240086a38c6871c97c6e5367a874 1 parent aab5080
Ricardo Signes authored July 03, 2012
18  lib/Exception/Reporter/Sender/Email.pm
@@ -37,11 +37,11 @@ reader.
37 37
 
38 38
 use Digest::MD5 ();
39 39
 use Email::Address ();
40  
-use Email::Date::Format qw(email_date);
41 40
 use Email::MIME::Creator ();
42 41
 use Email::MessageID ();
43 42
 use Email::Sender::Simple ();
44  
-use String::Truncate qw(elide);
  43
+use String::Truncate;
  44
+use Try::Tiny;
45 45
 
46 46
 sub new {
47 47
   my ($class, $arg) = @_;
@@ -165,7 +165,7 @@ sub send_report {
165 165
                   . "THIS EXCEPTION WAS CAUGHT AND EXECUTION CONTINUED\n"
166 166
                   . "THIS REPORT IS PROVIDED FOR INFORMATIONAL PURPOSES\n",
167 167
       attributes => {
168  
-        content_type => "text/plain", # could be better
  168
+        content_type => "text/plain",
169 169
         charset      => 'utf-8',
170 170
         encoding     => 'quoted-printable',
171 171
         name         => 'prelude',
@@ -189,8 +189,7 @@ sub send_report {
189 189
     header_str => [
190 190
       From => $self->from_header,
191 191
       To   => $self->to_header,
192  
-      Date => email_date,
193  
-      Subject      => elide("$reporter: $ident", 65),
  192
+      Subject      => String::Truncate::elide("$reporter: $ident", 65),
194 193
       'X-Mailer'   => __PACKAGE__,
195 194
       'Message-Id' => Email::MessageID->new(user => $internal_arg->{guid})
196 195
                                       ->in_brackets,
@@ -203,7 +202,7 @@ sub send_report {
203 202
     ],
204 203
   );
205 204
 
206  
-  eval {
  205
+  try {
207 206
     Email::Sender::Simple->send(
208 207
       $email,
209 208
       {
@@ -211,13 +210,10 @@ sub send_report {
211 210
         to      => [ $self->env_to ],
212 211
       }
213 212
     );
  213
+  } catch {
  214
+    Carp::cluck "failed to send exception report: $_";
214 215
   };
215 216
 
216  
-  if ($@) {
217  
-    Carp::cluck "failed to send exception report: $@";
218  
-    return;
219  
-  }
220  
-
221 217
   return;
222 218
 }
223 219
 
2  lib/Exception/Reporter/Summarizer/File.pm
@@ -26,8 +26,6 @@ sub summarize {
26 26
     File::Basename::basename($value->path)
27 27
   );
28 28
 
29  
-  # fn_base = sanitize leaf name
30  
-
31 29
   return {
32 30
     filename => $fn_base,
33 31
     mimetype => $value->mimetype,

0 notes on commit a8e7981

Please sign in to comment.
Something went wrong with that request. Please try again.