Subject: | folders_hash() attrs documentation mistake. |
Date: | Thu, 10 Sep 2015 17:24:39 +0200 |
To: | bug-Mail-IMAPClient [...] rt.cpan.org |
From: | Gilles LAMIRAL <gilles.lamiral [...] laposte.net> |
Hi Phil,
http://search.cpan.org/dist/Mail-IMAPClient/lib/Mail/IMAPClient.pod#folders_hash
The doc says:
{
name => 'Mail/Box/Name',
attrs => '\Marked \HasNoChildren',
delim => '/',
}
but the code returns something like this:
{
name => 'Mail/Box/Name',
attrs => [
'\Marked',
'\HasNoChildren'
]
delim => '/',
}
Also the code example given is wrong and show nothing useful, this one:
my $sattr_re = /\b\\(?:All|Archive|Drafts|Flagged|Junk|Sent|Trash)\b/;
foreach my $fhash (@fhashes) {
next unless ( $fhash->{attrs} =~ $sattr_re );
print("special: $fhash->{name} : $fhash->{attrs}\n");
}
The following match the code:
foreach my $fhash (@fhashes) {
my @special = grep ( /\\(?:All|Archive|Drafts|Flagged|Junk|Sent|Trash)/, @{ $fhash->{attrs} } ) ;
print("special: $fhash->{name} : @special\n") if ( @special ) ;
}
Checked on latest 3.37 Mail::IMAPClient.
Don't change the code, code is ok, change the doc.
Thanks in advance.
--
Au revoir, 09 51 84 42 42
Gilles Lamiral. France, Baulon (35580) 06 20 79 76 06