#!c:/usr/local/bin/perl # mktest # # This script converts a mail folder containing IMIP attachments # into a series of test files: test1.txt, test2.txt, ... # Each test file contains a single iCalendar object. # # To convert a series of test files back into a mail folder, # use mkfolder # # Usage: # mktest mailFolderName # # -sman if (0 > $#ARGV) { print STDERR "You need to supply a list of mail folders on the cmd line\n"; die; } foreach $i (0..$#ARGV) { if (!open(FOLDER,$ARGV[$i])) { print STDERR "Can't open $filename \n"; print STDERR "error: $!\n"; die; } $emitting = 0; $TestNo = 1; # mail folders are provided on the command line # spin through them, extract individual ical objects # and store them into text files. while ($line = ) { chop $line; if ( $line =~ /BEGIN:VCALENDAR/ ) { $emitting = 1; $TestName = "Test"."$TestNo".".txt"; # print ">>>>>>>>>>> CREATE: $TestName\n"; if (!open(TSTFILE,"> $TestName")) { print STDERR "Can't create $TestName \n"; print STDERR "error: $!\n"; die; } } if ($emitting == 1) { print TSTFILE "$line\n" ; } if ( $line =~ /END:VCALENDAR/ ) { $emitting = 0; # print "<<<<<<<<<<< CLOSE: $TestName\n"; ++$TestNo; close TSTFILE } } --$TestNo; print "Created $TestNo test files\n" }