/usr/share/perl5/Net/IMAP/SimpleX.pod is in libnet-imap-simple-perl 1.2205-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | =head1 NAME
Net::IMAP::SimpleX - Addons for Net::IMAP::Simple
=head1 SYNOPSIS
use strict;
use warnings;
use Net::IMAP::SimpleX;
L<Net::IMAP::SimpleX> uses L<Net::IMAP::Simple> as a base so the object creation
is the same as it is for the ancestor:
my $imap = Net::IMAP::SimpleX->new('imap.example.com') ||
die "Unable to connect to IMAP: $Net::IMAP::Simple::errstr\n";
$imap->select("INBOX");
L<Net::IMAP::SimpleX> is a collection of handy methods that are
not simple, require L<Parse::RecDescent>, or are experimental.
=head1 DESCRIPTION
This module adds some useful, yet not so simple, extensions on top of
L<Net::IMAP::Simple>.
=head1 METHODS
=over 4
=item new
For details on the invocation, read L<Net::IMAP::Simple>.
=item body_summary
Typical invocations will take this overall shape.
# get an object representation of the message body
my $summary = $imap->body_summary($message_number);
# multipart message
if ($summary->has_parts) {
for my $subpart ($summary->parts) {
if ($subpart->has_parts) { ... }
# examine the message part
my @attr = map { $subpart->$_ } qw/content_type encoding encoded_size/;
# fetch the raw message part
my $subpart_body = $imap->get($message_number, $subpart->part_number);
}
} else {
my $body = $summary->body;
my @attr = map { $body->$_ } qw/content_type encoding encoded_size/
}
This method returns a simple object that contains a representation of the body
of a message. The object is built by a L<Parse::RecDescent> parser using the
output of an IMAP I<fetch body> command. The parser uses the formal syntax as
defined by RFC3501 L<http://tools.ietf.org/html/rfc3501#section-9>.
my $body = $summary->body;
my @attr = map { $body->$_ } qw/
content_description
encoded_size
charset
content_type
part_number
format
id
encoding
/;
For multipart messages, the object contains sub-objects for each message part,
accessible via the parts() method and inspected via the has_parts() method.
The type method describes the type of multipart (such as mixed or alternative).
The parts method returns a list of sub parts, which themselves may have
subparts, and so on.
An example of a multipart, alternative message with a text body and an html
version of the body would looke something like:
if ($summary->has_parts) {
if ($summary->type eq 'alternative') {
my ($html) = grep { $_->content_type eq 'text/html' } $summary->parts;
}
}
A really complex, multipart message could look something like this:
if ($summary->has_parts && $summary->type eq 'mixed') {
for my $part ($summary->parts) {
if ($part->has_parts && $part->type eq 'mixed') { ... }
...
}
}
=item fetch
The fetch command returns the various parts of messages that users request. It
is fairly complicated (following RFC3501 using a grammar/parser), but there are
some basic patterns that it follows.
my $res =$imap->fetch('30:32' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS')
# $res = {
# 30 => {
# "BODY[HEADER.FIELDS (DATE)]" => "Date: Sun, 18 Jul 2010 20:54:48 -0400\r\n\r\n",
# "FLAGS" => ["\\Flagged", "\\Seen"],
# "UID" => 58890,
# },
# 31 => {
# "BODY[HEADER.FIELDS (DATE)]" => "Date: Wed, 21 Jul 2010 09:09:04 -0400\r\n\r\n",
# "FLAGS" => ["\\Seen"],
# "UID" => 58891,
# },
# 32 => {
# "BODY[HEADER.FIELDS (DATE)]" => "Date: Sat, 24 Jul 2010 05:12:06 -0700\r\n\r\n",
# "FLAGS" => ["\\Seen"],
# "UID" => 58892,
# },
# }
So-called "parenthized" lists will be returned as an array (see C<FLAGS>) but
nearly everything else will come back as strings. This includes parenthized
queries. Take C<BODY.PEAK[HEADER.FIELDS (DATE FROM SUBJECT)]>), for example.
The result would come back as the RFC822 header lines (as the above C<Date: Sun,
...> has done).
For more information about the different types of queries, see RFC3501. There's
a surprising number of things that can be queried.
=item uidfetch
This is roughly the same thing as the C<fetch()> method above, but the query
runs on UIDs instead of sequence numbers. The keys of the C<$res> are still the
sequence numbers though.
my $res =$imap->fetch('58890' => 'UID BODY.PEEK[HEADER.FIELDS (DATE)] FLAGS')
# $res = {
# 30 => {
# "BODY[HEADER.FIELDS (DATE)]" => "Date: Sun, 18 Jul 2010 20:54:48 -0400\r\n\r\n",
# "FLAGS" => ["\\Flagged", "\\Seen"],
# "UID" => 58890,
# },
# ...
=back
=head1 AUTHOR
=over 4
=item INITIAL AUTHOR
Jason Woodward C<< <woodwardj@jaos.org> >>
=item ADDITIONAL CONTRIBUTIONS
Paul Miller C<< <jettero@cpan.org> >> [I<fetch()>]
=back
=head1 COPYRIGHT
Copyright (c) 2010 Jason Woodward
All rights reserved. This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
=head1 LICENSE
This module is free software. You can redistribute it and/or
modify it under the terms of the Artistic License 2.0.
This program is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
=head1 BUGS
L<https://rt.cpan.org/Dist/Display.html?Queue=Net-IMAP-Simple>
=head1 SEE ALSO
L<perl>, L<Net::IMAP::Simple>, L<Parse::RecDescent>
|