Perl: Win32::OLE and Microsoft Outlook - Iterating through email attachments efficiently

后端 未结 2 1759
野趣味
野趣味 2021-01-13 07:46

I\'m an intern and very new to this...

My boss gets an email with two attachments every Monday which he has to turn into wiki code and put it on our internal website

相关标签:
2条回答
  • 2021-01-13 08:15

    You imported the in subroutine from the package Win32::OLE. It is probably some awful "syntactical sugar". And deeply unperlish. I suppose it returns some sort of list from the Win32::OLE object $Folder. So try this:

    foreach my $msg (reverse $Folder->{items}->in)
    

    or

    foreach my $msg (reverse in($Folder->{items}))
    

    Also, be sure to use strict and use warnings in every script to ensure high quality code. If you can be sure that a modern perl will be used, you can also use v5.10 and enjoy the say function – it behaves like print, but automatically appends a newline to your output.

    0 讨论(0)
  • 2021-01-13 08:21

    Try something like this

    foreach my $msg (reverse @{$Folder->{items}})
    

    don't use "in" in perl

    0 讨论(0)
提交回复
热议问题