Great advice, and I've printed the script out to look it over and pick out the code I have so far to place in subroutines.
As of now, I have changed some of the code to execute almost the entire code in a subroutine &ipod;, which I have set to match no matter what in a if/else statement (It runs the logger in both cases).
if ($from =~ /address|address2/ig) { if ($to =~ /address|address2/ig) { if ($textstuff =~ /sent from my ipod/ig || $textstuff =~ /sent from my + iphone/ig) { print "From ME----\nSubject: $subject\nFrom: $from\nTo: $to\nDate: $da +te\nContent Type: content\nMime Type: $mime\nEffective Type: $effecti +ve\n"; &ipod; } else { if ($textstuff !~ /sent from my ipod/ig || $textstuff !~ /sent from my + iphone/ig) { print "----NOT ipod ----\nSubject: $subject\nFrom: $from\nTo: $to\nDat +e: $date\nContent Type: content\nMime Type: $mime\nEffective Type: $e +ffective\n"; &ipod; }
It's ugly, but it gets the job done mostly. Unfortunately, it still suffers from only running through and prints only one instance of 'from ME' or '----NOT ipod' and then no longer prints any messages, other than the statement that it's moving files. Also, it never reaches the bottom statement to extract files using attachment:stripper, which is somewhat confusing.
I would imagine that it's a problem with the foreach statement only executing once due to the fact that it stops printing, but since it executes all the other code (opens the log file, prints to it, executes the moving of files), I just have to try to track down where the problem is happening as well as why it's not executing the attachment stripper section of code.
Thanks again for the reply, and once I can track down why the above is happening, I plan to redo it into subroutines (as well as all future scripts). :-)
In reply to Re^2: Perl MIME parser partially works with my code I wrote (code does not exist , there is no code)
by CalebH
in thread Perl MIME parser partially works
by CalebH
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |