{
    "mode": "perldoc",
    "parameter": "Net::Twitter::Role::AutoCursor",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ATwitter%3A%3ARole%3A%3AAutoCursor/json",
    "generated": "2026-10-09T12:19:03Z",
    "synopsis": "use Net::Twitter;\nmy $nt = Net::Twitter->new(\ntraits => [qw/AutoCursor API::RESTv11 RetryOnError OAuth/],\n# additional ags...\n);\n# Get friendsids or followersids without worrying about cursors\nmy $ids = $nt->followersids;\nmy $nt = Net::Twitter->new(\ntraits => [\nqw/API::RESTv11 RetryOnError OAuth/\nAutoCursor => { maxcalls => 32 },\nAutoCursor => {\nmaxcalls      => 4,\nforcecursor   => 1,\narrayaccessor => 'users',\nmethods        => [qw/friends followers/],\n},\n],\n# additional args\n);\n# works with any Twitter call that takes a cursor parameter\nmy $friends = $nt->friends;",
    "sections": {
        "NAME": {
            "content": "Net::Twitter::Role::AutoCursor - Help transition to cursor based access to friendsids and\nfollowersids methods\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 4.01043\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::Twitter;\nmy $nt = Net::Twitter->new(\ntraits => [qw/AutoCursor API::RESTv11 RetryOnError OAuth/],\n# additional ags...\n);\n\n# Get friendsids or followersids without worrying about cursors\nmy $ids = $nt->followersids;\n\nmy $nt = Net::Twitter->new(\ntraits => [\nqw/API::RESTv11 RetryOnError OAuth/\nAutoCursor => { maxcalls => 32 },\nAutoCursor => {\nmaxcalls      => 4,\nforcecursor   => 1,\narrayaccessor => 'users',\nmethods        => [qw/friends followers/],\n},\n],\n# additional args\n);\n\n# works with any Twitter call that takes a cursor parameter\nmy $friends = $nt->friends;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "On 25-Mar-2011, Twitter announced a change to \"friendsids\" and \"followersids\" API methods:\n\n[Soon] followers/ids and friends/ids is being updated to set the cursor to -1\nif it isn't supplied during the request. This changes the default response\nformat\n\nThis will break a lot of existing code. The \"AutoCursor\" trait was created to help users\ntransition to cursor based access for these methods.\n\nWith default parameters, the \"AutoCursor\" trait attempts a non-cursored call for \"friendsids\"\nand \"followersids\". If it detects a cursored response from Twitter, it continues to call the\nunderlying Twitter API method, with the next cursor, until it has received all results or 16\ncalls have been made (yielding 80,000 results). It returns an ARRAY reference to the combined\nresults.\n\nIf the \"cursor\" parameter is passed to \"friendsids\" or \"followersids\", \"Net::Twitter\" assumes\nthe user is handling cursoring and does not modify behavior or results.\n\nThe \"AutoCursor\" trait is parameterized, allowing it to work with any Twitter API method that\nexpects cursors, returning combined results for up to the maximum number of calls specified.\n\n\"AutoCursor\" can be applied multiple times to handle different sets of API methods.\n",
            "subsections": []
        },
        "PARAMETERS": {
            "content": "maxcalls\nAn integer specifying the maximum number of API calls to make. Default is 16.\n\n\"maxcalls\" can be overridden on a per-call basis by passing a \"maxcalls\" argument to the\nAPI method.\n\nforcecursor\nIf true, when the caller does not provide a \"cursor\" parameter, \"AutoCursor\" will use up to\n\"maxcalls\" cursored calls rather than attempting an initial non-cursored call. Default is\n0.\n\narrayaccessor\nThe name of the HASH key used to access the ARRAY ref of results in the data structure\nreturned by Twitter. Default is \"ids\".\n\nmethods\nA reference to an ARRAY containing the names of Twitter API methods to which \"AutoCursor\"\nwill be applied.\n",
            "subsections": []
        },
        "METHOD CALLS": {
            "content": "Synthetic parameter \"-maxcalls\" can be passed for individual method calls to override the\ndefault:\n\n$r = $nt->followersids({ -maxcalls => 200 }); # get up to 1 million ids\n\nSynthetic parameter \"-forcecursor\" can be passed to override the \"forcecursor\" default.\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Marc Mims <marc@questright.com>\n",
            "subsections": []
        },
        "COPYRIGHT": {
            "content": "Copyright (c) 2016 Marc Mims\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "This library is free software and may be distributed under the same terms as perl itself.\n",
            "subsections": []
        }
    },
    "summary": "Net::Twitter::Role::AutoCursor - Help transition to cursor based access to friendsids and followersids methods",
    "flags": [],
    "examples": [],
    "see_also": []
}