I'm trying to extract attachments from incoming emails and I'm using the following code related to MIME::Tools:
$parser = MIME::Parser->new();
$parser->output_dir("./tmp");
$message = $parser->parse_data($msg); # $msg contains the email contents
when calling $parser->parse_data($msg)
, the script fails with the following:
Undefined subroutine utf8::SWASHGET called at ./MIME/Parser/Filer.pm line 364
This happens to be the first instance of regex matching in the Filer.pm file, so I'm assuming it's something to do with the way to regex matching is performed. I put a regex match earlier just to see if it is indeed related to that and it failed on that exact spot with the same error.
Any help with regards to this? I have no problem retrieving the emails and their contents, but the attachments have been a pain.
My perl version is 5.8.9, MIME::Tools - 5.502, I'm not a root user and sadly have no access to root privileges (I'm getting around this by using
BEGIN { unshift @INC, "~email/mime"; }
at the top where /mime contains all the lib folders from the relevant CPAN modules, in this case MIME)
Thanks very much in advance!
After the helpful perl monks chimed in, the problem was that the shebang I was using pointed to an older version of perl (apparently there are two perl versions on our work environment, located in completely different locations which I had not been aware of).
It's still slightly mysterious why the older version would behave in such a way but I guess a solution to this would seem to be to upgrade to a newer version (as pointed out in the other post).
Anyway I'm not quite sure how okay cross-posting is, so apologies if my topic felt redundant due to being posted in two places, my initial motivation was that I'd get sufficiently different responses.