[Mimedefang] custom function - stripping attachments based onheaders

Ashley M. Kirchner ashley at pcraft.com
Tue Apr 30 17:59:59 EDT 2002


Terry Davis wrote:

> Ok, sorry for being a pest.  I tried simplifiying this more:
>
> open(HDRS, "<HEADERS");
> while( $line = <HDRS> ) {
>   chomp $line;
>   syslog('warning', "It worked\n");
> }

  Try this:

  #!/usr/bin/perl
  # You need to use Sys::Syslog to use the syslog() facility
  # open the log file, write to it, and close it
  # Don't put \n in syslog(), it quotes that text literally
  # Alternatively, read 'man Sys::Syslog'
  #
  # The following code will write 'It worked!' for each line in
  # the HEADERS file.

  use Sys::Syslog qw(:DEFAULT setlogsock);
  setlogsock('unix');
  openlog("MIMEDefang $$", 'ndelay', 'user');
  open (HDRS,"<./HEADERS") || die "Error: Couldn't open HEADERS: $!\n";
  while (<HDRS>) {
    chomp;
    syslog('notice', 'It worked!');
  }
  closelog();



--
W | I haven't lost my mind; it's backed up on tape somewhere.
  +--------------------------------------------------------------------
  Ashley M. Kirchner <mailto:ashley at pcraft.com>   .   303.442.6410 x130
  IT Director / SysAdmin / WebSmith             .     800.441.3873 x130
  Photo Craft Laboratories, Inc.            .     3550 Arapahoe Ave. #6
  http://www.pcraft.com ..... .  .    .       Boulder, CO 80303, U.S.A.






More information about the MIMEDefang mailing list