> Howdy group. > > In a recent post someone mentioned this url: > http://www.perl.com/pub/a/2004/06/10/email.html >
The key to understanding that snippet is the line: "Thankfully, MIME::Entity is a MIME-aware subclass of Mail::Internet;" and specifically that little word in the middle, 'subclass'. MIME::Entity objects are subclasses of Mail::Internet objects, so my understanding would be that anywhere in the article above the parts accessing lines, you should switch Mail::Internet to MIME::Entity and it should just work. Therefore, for more information about the 'parts' method you should check the docs for MIME::Entity as that is what provides the method. (Though I certainly agree that the author should have made his transition a bit more clear.) > > My question is about the Mail::Internet Mime::Entity object and example > mentioned at that url: > > > my $num_parts = $obj->parts; > for (0..$num_parts) { > my $part = $obj->parts($_); > ... > } > > > 1) $obj is the Mail::Internet object created above that example correct? > Yes, sort of. I believe to make it work you are going to have instantiate MIME::Entity on the original string rather than Mail::Internet. For future reference if you are ever wondering what type of object a variable is holding just print the reference, print "$obj"; In most cases will show you, in the other cases, when $obj can be stringified, use the 'ref' built-in, print ref($obj); Will tell you what kind of object you are accessing, which will then tell you what docs to look at first, making sure to check the docs for anything that that object subclasses/inherits. > 2) I can't seem to find out how to use $part to examine the part, and > the docs don't seem to helpful, so how do you use the object that is $part? > > Say to get the content, encoding, ctype, etc... > > Somethgin like this perhaps: > my $desc = $part->description(); > my $ctype = $part->ctype(); > > IE I'd like to ultimately get the attachment information seperated... > To get this information, you go through the same steps as any other header, aka request a head object from the part, and then access into it to get the various header's values. The mime/content-type is provided free of charge using either the 'mime_type' or 'effective_type' methods. > but anystart on what Ii can do with $part would be greatly appreciated. > Check the docs of MIME::Entity for more, http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>