[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] MacPerl: Attempting read of folder of files



I am running MacPerl 5.1.9r4 and am attempting to read a number of e-mail
files of which I want to extract the return path so as to block junk mail.
Unfortunately most of my work is done daily on NT 4.0 and MKSToolkit 6.1 using
perl. The script I have I believe would work on it, but I keep getting
following error:

# WagsWorld 2 :Applications:MacPerl  :00 Macperl  :PL001: Unable to open
aaaa , <STDIN> chunk 1.
File 'WagsWorld 2 :Applications:MacPerl  :00 Macperl  :PL001'; Line 44

It is probably something very simple I am missing, but any help would be
greatly appreciated.  I get the chdir to print that it was successful.

Thanks.

  Wags ;)

==  ---------------------------------------------------------------  ==

#
#   Wags and Wags, Inc. @ 1998
#
#   Description:    Read a folder of e-mail and generate a list of return
#		addresses which should not be received by my screen names.  After
#		I have it running, then I will expand to my other screen names.
#		Looking for following ( Example ):
#	Return-Path: <jackrey@shazu.com>
#EOD#
#
#  --------------------------------------------------------------- #
#  - Start of Subroutines -
#  ------------------------

#  - End   of Subroutines -
#  ------------------------
#  --------------------------------------------------------------- #
#
#   Set the following four variables for correct pointers
#
$prog         = sprintf"%-8s: ", $0;

$mainloc	=	"WagsWorld 2 :Documentation  :JunkMail";

if	(chdir($mainloc) ) {
	printf "change directory for:\n$mainloc\nworked as it should have!\n";
 }else {
	die "Unable to change location: $mainloc";
 }

printf "Please enter glob: ";
chop($globin = <STDIN>);

#($fileout) = @ARGV;
$fileout	=	"00ReturnPath";

printf "glob used in processing: $globin\n";

open(FILEOUT,">$fileout") || die "${prog}Unable to open $fileout";

$in = $out = 0;

while ($filein = <${globin}>) {
	open(FILEIN,"$filein")    || die "${prog}Unable to open $filein";
	printf "File %4d: %-31s\n", $in, $filein;
	INPUTT: while (<FILEIN>) {
		next INPUTT if ( !/^.*Return-Path: /);
		$start	=	index($_,"<");
		$start++;
		$len	=	length($_);
		$len	=	$len - $start;
		$return_addr = substr($_,$start,$len);
		printf "Return-Path: $return-addr";
		$out++;
		last INPUTT;
	 }	# end of main read loop
	close(FILEINE);
 }	# end of main while loop


printf "${prog}Read: %5d  Writes:%5d\n", $in, $out;

close(FILEOUT);


***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch