{
    "content": [
        {
            "type": "text",
            "text": "# Log::Log4perl::Config::Watch (perldoc)\n\n## NAME\n\nLog::Log4perl::Config::Watch - Detect file changes\n\n## SYNOPSIS\n\nuse Log::Log4perl::Config::Watch;\nmy $watcher = Log::Log4perl::Config::Watch->new(\nfile            => \"/data/my.conf\",\ncheckinterval  => 30,\n);\nwhile(1) {\nif($watcher->changedetected()) {\nprint \"Change detected!\\n\";\n}\nsleep(1);\n}\n\n## DESCRIPTION\n\nThis module helps detecting changes in files. Although it comes with the \"Log::Log4perl\"\ndistribution, it can be used independently.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **LICENSE**\n- **AUTHOR**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Log::Log4perl::Config::Watch",
        "section": "",
        "mode": "perldoc",
        "summary": "Log::Log4perl::Config::Watch - Detect file changes",
        "synopsis": "use Log::Log4perl::Config::Watch;\nmy $watcher = Log::Log4perl::Config::Watch->new(\nfile            => \"/data/my.conf\",\ncheckinterval  => 30,\n);\nwhile(1) {\nif($watcher->changedetected()) {\nprint \"Change detected!\\n\";\n}\nsleep(1);\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 14,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 73,
                "subsections": []
            },
            {
                "name": "LICENSE",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 17,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Log::Log4perl::Config::Watch - Detect file changes\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Log::Log4perl::Config::Watch;\n\nmy $watcher = Log::Log4perl::Config::Watch->new(\nfile            => \"/data/my.conf\",\ncheckinterval  => 30,\n);\n\nwhile(1) {\nif($watcher->changedetected()) {\nprint \"Change detected!\\n\";\n}\nsleep(1);\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module helps detecting changes in files. Although it comes with the \"Log::Log4perl\"\ndistribution, it can be used independently.\n\nThe constructor defines the file to be watched and the check interval in seconds. Subsequent\ncalls to \"changedetected()\" will\n\n*   return a false value immediately without doing physical file checks if \"checkinterval\"\nhasn't elapsed.\n\n*   perform a physical test on the specified file if the number of seconds specified in\n\"checkinterval\" have elapsed since the last physical check. If the file's modification date\nhas changed since the last physical check, it will return a true value, otherwise a false\nvalue is returned.\n\nBottom line: \"checkinterval\" allows you to call the function \"changedetected()\" as often as\nyou like, without paying the performing a significant performance penalty because file system\noperations are being performed (however, you pay the price of not knowing about file changes\nuntil \"checkinterval\" seconds have elapsed).\n\nThe module clearly distinguishes system time from file system time. If your (e.g. NFS mounted)\nfile system is off by a constant amount of time compared to the executing computer's clock,\nit'll just work fine.\n\nTo disable the resource-saving delay feature, just set \"checkinterval\" to 0 and\n\"changedetected()\" will run a physical file test on every call.\n\nIf you already have the current time available, you can pass it on to \"changedetected()\" as an\noptional parameter, like in\n\nchangedetected($time)\n\nwhich then won't trigger a call to \"time()\", but use the value provided.\n\nSIGNAL MODE\nInstead of polling time and file changes, \"new()\" can be instructed to set up a signal handler.\nIf you call the constructor like\n\nmy $watcher = Log::Log4perl::Config::Watch->new(\nfile    => \"/data/my.conf\",\nsignal  => 'HUP'\n);\n\nthen a signal handler will be installed, setting the object's variable \"$self->{signalcaught}\"\nto a true value when the signal arrives. Comes with all the problems that signal handlers go\nalong with.\n\nTRIGGER CHECKS\nTo trigger a physical file check on the next call to \"changedetected()\" regardless if\n\"checkinterval\" has expired or not, call\n\n$watcher->forcenextcheck();\n\non the watcher object.\n\nDETECT MOVED FILES\nThe watcher can also be used to detect files that have moved. It will not only detect if a\nwatched file has disappeared, but also if it has been replaced by a new file in the meantime.\n\nmy $watcher = Log::Log4perl::Config::Watch->new(\nfile           => \"/data/my.conf\",\ncheckinterval => 30,\n);\n\nwhile(1) {\nif($watcher->filehasmoved()) {\nprint \"File has moved!\\n\";\n}\nsleep(1);\n}\n\nThe parameters \"checkinterval\" and \"signal\" limit the number of physical file system checks,\nsimilarly as with \"changedetected()\".\n",
                "subsections": []
            },
            "LICENSE": {
                "content": "Copyright 2002-2013 by Mike Schilli <m@perlmeister.com> and Kevin Goess <cpan@goess.org>.\n\nThis library is free software; you can redistribute it and/or modify it under the same terms as\nPerl itself.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Please contribute patches to the project on Github:\n\nhttp://github.com/mschilli/log4perl\n\nSend bug reports or requests for enhancements to the authors via our\n\nMAILING LIST (questions, bug reports, suggestions/patches): log4perl-devel@lists.sourceforge.net\n\nAuthors (please contact them via the list above, not directly): Mike Schilli\n<m@perlmeister.com>, Kevin Goess <cpan@goess.org>\n\nContributors (in alphabetical order): Ateeq Altaf, Cory Bennett, Jens Berthold, Jeremy Bopp,\nHutton Davidson, Chris R. Donnelly, Matisse Enzer, Hugh Esco, Anthony Foiani, James FitzGibbon,\nCarl Franks, Dennis Gregorovic, Andy Grundman, Paul Harrington, Alexander Hartmaier David Hull,\nRobert Jacobson, Jason Kohles, Jeff Macdonald, Markus Peter, Brett Rann, Peter Rabbitson, Erik\nSelberg, Aaron Straup Cope, Lars Thegler, David Viner, Mac Yang.\n",
                "subsections": []
            }
        }
    }
}