Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Encode::MIME::EncWords module

by Barryet (Initiate)
on Mar 18, 2020 at 14:45 UTC ( [id://11114430]=perlquestion: print w/replies, xml ) Need Help??

Barryet has asked for the wisdom of the Perl Monks concerning the following question:

I wrote a script to retrieve the filename from the attachment of an email. (by use of Encode::MIME::EncWords module.

$fname= decode('MIME-EncWords',$subentity->head->mime_attr('content-ty +pe.name'));

If the email message is correctly format. It is OK to retrieve the filename.

But if the email message is broken and missing the filename attribute. It will trigger error in EncWords module and exit.

Use of uninitialized value $str in scalar assignment at /usr/share/per +l5/vendor_perl/Encode/MIME/EncWords.pm line 61. Use of uninitialized value $str in pattern match (m//) at /usr/share/p +erl5/vendor_perl/Encode/MIME/EncWords.pm line 62.

Can I identify missing attribute of broken email message within my script and I handle this error.

Replies are listed 'Best First'.
Re: Encode::MIME::EncWords module
by huck (Prior) on Mar 18, 2020 at 16:30 UTC

    my $fname0= $subentity->head->mime_attr('content-type.name'); unless (defined $fname0) { ### do some error proc } else { $fname= decode('MIME-EncWords',$fname0); # do rest of normal stuff }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11114430]
Approved by marto
Front-paged by 1nickt
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (9)
As of 2024-04-19 16:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found