Hi, In the absence of an answer from the more experienced list members, I'll give it a shot. I don't know what kind of structure is being returned, but maybe you can use the Data::Dumper module to format the output, inserting the following two lines (in the appropriate places). use Data::Dumper; print Dumper($struct); Alternatively, if it is a simple hash you could use something like foreach (sort keys %{$struct}) { print "$_ => $struct->{$_}\n"; } which would print the key/value pairs in sorted order. Thanks to John Edwards for similar code in an earlier post. -----Original Message----- From: Chris Rogers [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 02, 2001 09:38 To: Beginners@Perl. Org (E-mail) Subject: Confusion with hash reference and Mail::IMAPClient I am using the Mail::IMAPClient module and the extension BodyStructure to connect to Exchange Server 5.5. Everything seems to be working great ( I love this module ) except for one thing. When I use the BodyStructure extension, either nothing is being returned in the object or I don't know how to access it. I can log on to server, query the mailbox and all it's folders without any trouble but I can't seem to get a message bodystructure. The docs show one example but I can't seem to get it to work for me. Here's a snippet of code: ##################################################### use CGI; use Mail::IMAPClient; use Mail::IMAPClient::BodyStructure; $imapp = Mail::IMAPClient->new ( Server => $servername, User => $username, Password => $password, Uid => 1, Debug => 1 ); $imapp->select($foldername); my $struct = Mail::IMAPClient::BodyStructure->new($imapp->fetch($msguid,"bodystructure")) ; $btype = $struct->bodytype; $bsubtype = $struct->bodysubtype; ##################################################### When the code is run, I don't get any errors but I don't get the bodystructure either. I have tried this many different ways but none seem to work. Having turned on the debug option, I can see that the request is sent to the server and the server does respond: 3 UID FETCH 12 bodystructure Sent 30 bytes Read: * 2 FETCH (BODYSTRUCTURE ("TEXT" "PLAIN" ("CHARSET" "US-ASCII") NIL NIL "7BIT" 489 9 NIL NIL NIL) UID 12) 3 OK FETCH completed If I print $struct, I get the following though the =HASH(...) part varies: Mail::IMAPClinet::BodyStructure=HASH(0x87d6b64) If anyone has any ideas, please let me know. Any help would be greatly appreciated. Thanks, Chris -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Confusion with hash reference and Mail::IMAPClient
Wagner Jeff Civ Logicon/TTMS Fri, 03 Aug 2001 08:23:27 -0700
- Confusion with hash reference and Mail::IMAPC... Chris Rogers
- RE: Confusion with hash reference and Ma... Wagner Jeff Civ Logicon/TTMS
- RE: Confusion with hash reference an... Matthew Lyon
- Re: Confusion with hash reference and Ma... Michael Fowler
- Re: Confusion with hash reference and Ma... Peter Scott