NAME
Twilio::Stream - Iterator over the records of several pages
SYNOPSIS
my $stream = $client->messages->stream({}, 100, 50);
while (my $message = $stream->next) {
say $message->body;
}
DESCRIPTION
Returns records one at a time and fetches each page only when it is needed, so it can walk long lists without holding them in memory. Where PHP uses foreach over a stream, Perl uses while over "next".
METHODS
new
my $stream = Twilio::Stream->new($page, $limit, $page_limit);
Starts at the Twilio::Page $page. It stops after $limit records or $page_limit pages. Without them, or with zero, it reads until the last page.
next
my $record = $stream->next;
Returns the next record, or nothing when there are no more.
rewind
$stream->rewind;
Starts again from the first page. Later pages are fetched again.
LICENSE
Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.