{
    "mode": "perldoc",
    "parameter": "Net::Twitter::Role::RetryOnError",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ATwitter%3A%3ARole%3A%3ARetryOnError/json",
    "generated": "2026-10-07T20:23:50Z",
    "synopsis": "use Net::Twitter;\n$nt = Net::Twitter->new(\ntraits      => ['API::RESTv11', 'RetryOnError']\nmaxretries => 3,\n);",
    "sections": {
        "NAME": {
            "content": "Net::Twitter::Role::RetryOnError - Retry Twitter API calls on error\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 4.01043\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::Twitter;\n$nt = Net::Twitter->new(\ntraits      => ['API::RESTv11', 'RetryOnError']\nmaxretries => 3,\n);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Temporary errors are not uncommon when calling the Twitter API. When applied to Net::Twitter\nthis role will provide automatic retries of API calls in a very configurable way.\n\nIt only retries when the response status code is >= 500. Other error codes indicate a permanent\nerror. If the maximum number of retries is reached, without success, an exception is thrown, as\nusual.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "This role adds the following options to \"new\":\n\ninitialretrydelay\nA floating point number specifying the initial delay, after an error, before retrying.\nDefault: 0.25 (250 milliseconds).\n\nmaxretrydelay\nA floating point number specifying the maximum delay between retries. Default: 4.0\n\nretrydelaymultiplier\nOn the second and subsequent retries, a new delay is calculated by multiplying the previous\ndelay by \"retrydelaymultiplier\". Default: 2.0\n\nmaxretries\nThe maximum number of consecutive retries before giving up and throwing an exception. If set\nto 0, it the API call will be retried indefinitely. Default 5.\n\nretrydelaycode\nA code reference that will be called to handle the delay. It is passed a single argument: a\nfloating point number specifying the number of seconds to delay. By default, \"sleep\" in\nTime::HiRes is called.\n\nIf you're using a non-blocking user agent, like Coro::LWP, you should use this option to\nprovide a non-blocking delay.\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::RetryOnError - Retry Twitter API calls on error",
    "flags": [],
    "examples": [],
    "see_also": []
}