1Mail::Server::IMAP4::LiUsste(r3)Contributed Perl DocumenMtaaitli:o:nServer::IMAP4::List(3)
2
3
4
6 Mail::Server::IMAP4::List - folder related IMAP4 answers
7
9 my $imap = Mail::Server::IMAP4::List->new
10 ( folders => $folders # Mail::Box::Identity
11 , inbox => $inbox # Mail::Box
12 , delimiter => '#'
13 );
14
15 my $imap = Mail::Server::IMAP4::List->new(user => $user);
16 print $imap->list(...); # for LIST command
17
20 Constructors
21
22 Mail::Server::IMAP4::List->new(USER)
23
24 Create a (temporary) object to handle the LIST requests for a cer‐
25 tain user, based upon a set of folders. The data is kept by
26 Mail::Box::Identity and Mail::Box::Collection objects, which mean
27 that the folders will not be opened to answer these questions.
28
29 Option --Default
30 delimeter '/'
31 folders <from user>
32 inbox <from user>
33 user <undef>
34
35 . delimeter STRING⎪CODE
36
37 Either the constant delimiter, or a code reference which will
38 get passed a folder name and should return the delimiter string
39 used in that name. If that folder name is empty, the default
40 delimiter must be reported. See delimiter() for an example.
41
42 . folders OBJECT
43
44 You need to specify either a set of folders explicitly or via
45 the user. Some Mail::Box::Identity OBJECT is needed.
46
47 . inbox BOOLEAN
48
49 For now, only used to see whether there is an inbox, so a truth
50 value will do. This may change in the future. By default, the
51 flag is set if "$user-"inbox> is defined.
52
53 . user OBJECT
54
55 A Mail::Box::Manage::User OBJECT, representing the user who's
56 folders must get reported.
57
58 Attributes
59
60 $obj->delimiter([FOLDERNAME])
61
62 Returns the delimiter string. The foldername is only required when
63 a CODE reference was specified at initiation.
64
65 Example: setting-up an IMAP4 delimeter
66
67 sub delim($)
68 { my $path = shift;
69 my ($delim, $root)
70 = $path =~ m/^(#news\.)/ ? ('.', $1)
71 = $path =~ m!^/! ? ('/', '/')
72 : ('/', '');
73
74 wantarray ? ($delim, $root) : $delim;
75 }
76
77 my $list = Mail::Server::IMAP4::List->new(delimiter => \&delim, ...);
78 print $list->delimiter('abc/xyz'); # returns a / (slash) and ''
79 print $list->delimiter('#news.feed'); # returns a . (dot) and $news.
80 print $list->delimiter(''); # returns default delimiter
81
82 $obj->folders
83
84 Returns the Mail::Box::Identity of the toplevel folder.
85
86 $obj->inbox
87
88 Returns the Mail::Box or filename of the INBOX.
89
90 $obj->user
91
92 Returns the Mail::Box::Manage::User object, if defined.
93
94 IMAP Commands
95
96 $obj->list(BASE, PATTERN)
97
98 IMAP's LIST command. The request must be partially decoded, the
99 answer will need to be encoded.
100
101 Example: using IMAP list
102
103 my $imap = Mail::Server::IMAP4::List->new(delimiter => \&delim, ...);
104 local $" = ';';
105
106 my @lines = $imap->list('', ''); # returns the default delimiter
107 print ">@{$lines[0]}<"; # >(\Noselect);/;<
108
109 my @lines = $imap->list('#news',''); # specific delimiter
110 print ">@{$lines[0]}<"; # >(\Noselect);.;<
111
112 my @lines = $imap->list('top/x/', '%');
113 print ">@$_<," foreach @lines; # >();/;/tmp/x/y<,>(\Marked);/;/tmp/x/z<
114
116 See
117
118 RFC2060: "Internet Message Access Protocol IMAP4v1"
119 sections 6.3.8 (LIST question) and 7.2.2 (LIST answer)
120
122 This module is part of Mail-Box distribution version 2.070, built on
123 March 25, 2007. Website: http://perl.overmeer.net/mailbox/
124
126 Copyrights 2001-2007 by Mark Overmeer.For other contributors see
127 ChangeLog.
128
129 This program is free software; you can redistribute it and/or modify it
130 under the same terms as Perl itself. See
131 http://www.perl.com/perl/misc/Artistic.html
132
133
134
135perl v5.8.8 2007-03-25 Mail::Server::IMAP4::List(3)