AnyEvent-IMAP
view release on metacpan or search on metacpan
lib/Mail/IMAP/Util.pm view on Meta::CPAN
# This is probably the simplest/dumbest way to parse the IMAP output.
# Nevertheless it seems to be very stable and fast.
#
# $input is an array ref containing IMAP output. Normally it will
# contain only one entry -- a line of text -- but when IMAP sends
# literal data, we read it separately (see _read_literal) and store it
# as a scalar reference, therefore it can be like this:
#
# [ '* 11 FETCH (RFC822.TEXT ', \$DATA, ')' ]
#
# so that's why the routine looks a bit more complicated.
#
# It returns an array of tokens. Literal strings are dereferenced so
# for the above text, the output will be:
#
# [ '*', '11', 'FETCH', [ 'RFC822.TEXT', $DATA ] ]
#
# note that lists are represented as arrays.
#
sub imap_parse_tokens {
my ($input, $no_deref) = @_;
( run in 0.355 second using v1.01-cache-2.11-cpan-64827b87656 )