/[clipping]/mimex
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /mimex

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by dpavlin, Mon Jul 16 09:57:03 2001 UTC revision 1.4 by dpavlin, Sat Nov 3 10:15:41 2001 UTC
# Line 8  use Digest::MD5 qw(md5_hex); Line 8  use Digest::MD5 qw(md5_hex);
8    
9  use MIME::Parser;  use MIME::Parser;
10    
11  my $outdir = "/tmp/store";  my $outdir = "/data/store";
12  my $msgdir = "/tmp/mime$$";     # temp  my $msgdir = "/data/store/tmp/mime$$";  # temp
13  my $to = "dpavlin@pliva.hr";  my $from = 'clipping-info@pliva.hr';
14    my $to = 'clipdir@pliva.hr';
15    my $log = "/data/store/mimex.log";
16    
17  print "From: Press Clipping <pcst\@pliva.hr>\nSubject: Press Clipping update\n\n";  open(LOG,">> $log") || warn "log $log: $!";
18    
19    open(MAIL,"| /usr/sbin/sendmail $to") || die "sendmail: $!";
20    
21    print MAIL "From: Press Clipping <$from>\nSubject: Press Clipping update\n\n";
22    
23  #------------------------------------------------------------  #------------------------------------------------------------
24  # dump_entity - dump an entity's file info  # dump_entity - dump an entity's file info
# Line 28  sub dump_entity { Line 34  sub dump_entity {
34  #             " (", scalar($ent->head->mime_type), ")\n";  #             " (", scalar($ent->head->mime_type), ")\n";
35          if ($ent->head->mime_type =~ m,text/plain,i) {          if ($ent->head->mime_type =~ m,text/plain,i) {
36                  open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!";                  open(I,$ent->bodyhandle->path) || die "$ent->bodyhandle->path: $!";
37                  while(<I>) { print $_; }                  while(<I>) { print MAIL $_; }
38                  close(I);                  close(I);
39                  unlink $ent->bodyhandle->path;                  unlink $ent->bodyhandle->path;
40          } else {          } else {
# Line 40  sub dump_entity { Line 46  sub dump_entity {
46                  my $md5=md5_hex($new.time());                  my $md5=md5_hex($new.time());
47                  mkdir "$outdir/$md5",0755 || die "mkdir $outdir/$md5: $!";                  mkdir "$outdir/$md5",0755 || die "mkdir $outdir/$md5: $!";
48                  rename $file,"$outdir/$md5/$new" || die "$file -> $md5 $new: $!";                  rename $file,"$outdir/$md5/$new" || die "$file -> $md5 $new: $!";
49                  print "\nhttp://store.pliva.hr/$md5/$new\n";                  print MAIL "\n","-" x 76,"\nhttp://store.pliva.hr/$md5/$new\n";
50                    print LOG "http://store.pliva.hr/$md5/$new\n";
51          }          }
52      }      }
53  }  }
# Line 76  exit (&main ? 0 : -1); Line 83  exit (&main ? 0 : -1);
83  #------------------------------------------------------------  #------------------------------------------------------------
84  1;  1;
85    
   
   
   
   
   

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.4

  ViewVC Help
Powered by ViewVC 1.1.26