_ TWF  _ Code Chap 26

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HOME | BACK | NEXT | MENU | SEARCH | ORDER | COMMENT | HELPINFO -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

26code01.pl


  open(MBOX, $index{$mbox});

  while(<MBOX>) {

    if (substr($_, 0, 5) eq "From ") {

      ++$i;

      @tmp = split(/\s+/, $_);

      shift @tmp;

      @from[$i] = shift @tmp;

      while ($q = shift @tmp) { @date[$i] .= "$q "; }

      }

    elsif ((substr($_, 0, 9) eq "Subject: ") && (!@subject[$i])) {

      @subject[$i] = substr($_, 9);

      chop @subject[$i];

      }

    @listing[$i] .= $_;

    }

  close(MBOX);




26code02.pl


  print "Content-type: text/html\n\n";



  print "<title>Messages in $mbox</title>\n";

  print "<h1>Messages in $mbox</h1>\n";



  foreach $i (1..(@listing -1)) {

    print "<dl><dt><a href=\"/cgi-bin/mail2html/view/$mbox/$i\">$mbox message $i</a><br>\n";

    print "<dd><xmp>From:     " . @from[$i] . "\n";

    print "Subject:  " . @subject[$i] . "\n";

    print "Date:     " . @date[$i] . "</xmp></dl><P>\n\n";

    }



  print $footer;

  }




26code03.pl

sub pref {

  my ($file, $href, $label) = @_;

  if ($fancy) {

  	my @stat = stat("$root/$file");

  	my $type;

  	if (-d _)    { $type = 'dir';  }

  	elsif (-T _) { $type = 'text'; }

  	elsif (-B _) { $type = 'bin';  }

  	print $icon{$type},

  	      "<a href=\"$href\">$label</a>",

  	      &buffer($label, 35, $spacer),

        	 &rprint(&nicenum($stat[7]), 12, $spacer),

         	 "\n";

    }

  else {

    print "<a href=\"$href\">$label</a><br>\n";

    }

  }




26code04.pl


if (! -e $gifpathname) {

        system ("cp $pathname /home/transfer/bill.ps");

        system ("/usr/bin/remsh goanna '/usr/bin/gs -q -dNOPAUSE -r80x67 -dMAGSTEP=.5 -sDEVICE=gif8 -sOutputFile=/home/transfer/bill.gif -- /home/transfer/bill.ps'");

        system ("cp /home/transfer/bill.gif $gifpathname");

        system ("rm -f /home/transfer/bill.gif /home/transfer/bill.ps");

}




-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
HOME | BACK | NEXT | MENU | SEARCH | ORDER | COMMENT | HELPINFO -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

E-Mail: The Web Foundations at twf@lanw.com
URL: http://www.lanw.com/twf/codech26.htm
Text - Copyright © 1995, Ed Tittel, Mark Gaither, Sebastian Hassinger, & Mike Erwin.
Web Layout - Copyright © 1995, LANWrights & IMPACT Online.
Revised -- February 15th, 1996 [James Michael Stewart - WebMaster - IMPACT Online]

HTML 2.0 Checked!