{
    "content": [
        {
            "type": "text",
            "text": "# inc (perldoc)\n\n## Section Outline\n\n- **Found in /usr/share/perl/5.34/pod/perlfaq1.pod** (34 lines)\n- **Found in /usr/share/perl/5.34/pod/perlfaq4.pod** (7 lines)\n- **Found in /usr/share/perl/5.34/pod/perlfaq5.pod** (23 lines)\n- **Found in /usr/share/perl/5.34/pod/perlfaq7.pod** (17 lines)\n- **Found in /usr/share/perl/5.34/pod/perlfaq8.pod** (47 lines)\n\n## Full Content\n\n### Found in /usr/share/perl/5.34/pod/perlfaq1.pod\n\nHow can I convince others to use Perl?\n(contributed by brian d foy)\n\nAppeal to their self interest! If Perl is new (and thus scary) to them,\nfind something that Perl can do to solve one of their problems. That\nmight mean that Perl either saves them something (time, headaches,\nmoney) or gives them something (flexibility, power, testability).\n\nIn general, the benefit of a language is closely related to the skill of\nthe people using that language. If you or your team can be faster,\nbetter, and stronger through Perl, you'll deliver more value. Remember,\npeople often respond better to what they get out of it. If you run into\nresistance, figure out what those people get out of the other choice and\nhow Perl might satisfy that requirement.\n\nYou don't have to worry about finding or paying for Perl; it's freely\navailable and several popular operating systems come with Perl.\nCommunity support in places such as Perlmonks (\n<http://www.perlmonks.com> ) and the various Perl mailing lists (\n<http://lists.perl.org> ) means that you can usually get quick answers\nto your problems.\n\nFinally, keep in mind that Perl might not be the right tool for every\njob. You're a much better advocate if your claims are reasonable and\ngrounded in reality. Dogmatically advocating anything tends to make\npeople discount your message. Be honest about possible disadvantages to\nyour choice of Perl since any choice has trade-offs.\n\nYou might find these links useful:\n\n*   <http://www.perl.org/about.html>\n\n*   <http://perltraining.com.au/whyperl.html>\n\n### Found in /usr/share/perl/5.34/pod/perlfaq4.pod\n\nWhy don't my tied hashes make the defined/exists distinction?\nThis depends on the tied hash's implementation of EXISTS(). For example,\nthere isn't the concept of undef with hashes that are tied to DBM*\nfiles. It also means that exists() and defined() do the same thing with\na DBM* file, and what they end up doing is not what they do with\nordinary hashes.\n\n### Found in /usr/share/perl/5.34/pod/perlfaq5.pod\n\nI still don't get locking. I just want to increment the number in the file. How can I do this?\nDidn't anyone ever tell you web-page hit counters were useless? They\ndon't count number of hits, they're a waste of time, and they serve only\nto stroke the writer's vanity. It's better to pick a random number;\nthey're more realistic.\n\nAnyway, this is what you can do if you can't help yourself.\n\nuse Fcntl qw(:DEFAULT :flock);\nsysopen my $fh, \"numfile\", ORDWR|OCREAT or die \"can't open numfile: $!\";\nflock $fh, LOCKEX                        or die \"can't flock numfile: $!\";\nmy $num = <$fh> || 0;\nseek $fh, 0, 0                            or die \"can't rewind numfile: $!\";\ntruncate $fh, 0                           or die \"can't truncate numfile: $!\";\n(print $fh $num+1, \"\\n\")                  or die \"can't write numfile: $!\";\nclose $fh                                 or die \"can't close numfile: $!\";\n\nHere's a much better web-page hit counter:\n\n$hits = int( (time() - 850000000) / rand(1000) );\n\nIf the count doesn't impress your friends, then the code might. :-)\n\n### Found in /usr/share/perl/5.34/pod/perlfaq7.pod\n\nWhy can't a method included in this same file be found?\nSome possible reasons: your inheritance is getting confused, you've\nmisspelled the method name, or the object is of the wrong type. Check\nout perlootut for details about any of the above cases. You may also use\n\"print ref($object)\" to find out the class $object was blessed into.\n\nAnother possible reason for problems is that you've used the indirect\nobject syntax (eg, \"find Guru \"Samy\"\") on a class name before Perl has\nseen that such a package exists. It's wisest to make sure your packages\nare all defined before you start using them, which will be taken care of\nif you use the \"use\" statement instead of \"require\". If not, make sure\nto use arrow notation (eg., \"Guru->find(\"Samy\")\") instead. Object\nnotation is explained in perlobj.\n\nMake sure to read about creating modules in perlmod and the perils of\nindirect objects in \"Method Invocation\" in perlobj.\n\n### Found in /usr/share/perl/5.34/pod/perlfaq8.pod\n\nWhere do I get the include files to do ioctl() or syscall()?\nHistorically, these would be generated by the h2ph tool, part of the\nstandard perl distribution. This program converts cpp(1) directives in C\nheader files to files containing subroutine definitions, like\n\"SYSgetitimer()\", which you can use as arguments to your functions. It\ndoesn't work perfectly, but it usually gets most of the job done. Simple\nfiles like errno.h, syscall.h, and socket.h were fine, but the hard ones\nlike ioctl.h nearly always need to be hand-edited. Here's how to install\nthe *.ph files:\n\n1. Become the super-user\n2. cd /usr/include\n3. h2ph *.h */*.h\n\nIf your system supports dynamic loading, for reasons of portability and\nsanity you probably ought to use h2xs (also part of the standard perl\ndistribution). This tool converts C header files to Perl extensions. See\nperlxstut for how to get started with h2xs.\n\nIf your system doesn't support dynamic loading, you still probably ought\nto use h2xs. See perlxstut and ExtUtils::MakeMaker for more information\n(in brief, just use make perl instead of a plain make to rebuild perl\nwith a new static extension).\n\nHow do I add a directory to my include path (@INC) at runtime?\nHere are the suggested ways of modifying your include path, including\nenvironment variables, run-time switches, and in-code statements:\n\nthe \"PERLLIB\" environment variable\n$ export PERLLIB=/path/to/my/dir\n$ perl program.pl\n\nthe \"PERL5LIB\" environment variable\n$ export PERL5LIB=/path/to/my/dir\n$ perl program.pl\n\nthe \"perl -Idir\" command line flag\n$ perl -I/path/to/my/dir program.pl\n\nthe \"lib\" pragma:\nuse lib \"$ENV{HOME}/myownperllib\";\n\nthe local::lib module:\nuse local::lib;\n\nuse local::lib \"~/myownperllib\";\n\n"
        }
    ],
    "structuredContent": {
        "command": "inc",
        "section": "-q",
        "mode": "perldoc",
        "summary": null,
        "synopsis": null,
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq1.pod",
                "lines": 34,
                "subsections": []
            },
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq4.pod",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq5.pod",
                "lines": 23,
                "subsections": []
            },
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq7.pod",
                "lines": 17,
                "subsections": []
            },
            {
                "name": "Found in /usr/share/perl/5.34/pod/perlfaq8.pod",
                "lines": 47,
                "subsections": []
            }
        ],
        "sections": {
            "Found in /usr/share/perl/5.34/pod/perlfaq1.pod": {
                "content": "How can I convince others to use Perl?\n(contributed by brian d foy)\n\nAppeal to their self interest! If Perl is new (and thus scary) to them,\nfind something that Perl can do to solve one of their problems. That\nmight mean that Perl either saves them something (time, headaches,\nmoney) or gives them something (flexibility, power, testability).\n\nIn general, the benefit of a language is closely related to the skill of\nthe people using that language. If you or your team can be faster,\nbetter, and stronger through Perl, you'll deliver more value. Remember,\npeople often respond better to what they get out of it. If you run into\nresistance, figure out what those people get out of the other choice and\nhow Perl might satisfy that requirement.\n\nYou don't have to worry about finding or paying for Perl; it's freely\navailable and several popular operating systems come with Perl.\nCommunity support in places such as Perlmonks (\n<http://www.perlmonks.com> ) and the various Perl mailing lists (\n<http://lists.perl.org> ) means that you can usually get quick answers\nto your problems.\n\nFinally, keep in mind that Perl might not be the right tool for every\njob. You're a much better advocate if your claims are reasonable and\ngrounded in reality. Dogmatically advocating anything tends to make\npeople discount your message. Be honest about possible disadvantages to\nyour choice of Perl since any choice has trade-offs.\n\nYou might find these links useful:\n\n*   <http://www.perl.org/about.html>\n\n*   <http://perltraining.com.au/whyperl.html>\n",
                "subsections": []
            },
            "Found in /usr/share/perl/5.34/pod/perlfaq4.pod": {
                "content": "Why don't my tied hashes make the defined/exists distinction?\nThis depends on the tied hash's implementation of EXISTS(). For example,\nthere isn't the concept of undef with hashes that are tied to DBM*\nfiles. It also means that exists() and defined() do the same thing with\na DBM* file, and what they end up doing is not what they do with\nordinary hashes.\n",
                "subsections": []
            },
            "Found in /usr/share/perl/5.34/pod/perlfaq5.pod": {
                "content": "I still don't get locking. I just want to increment the number in the file. How can I do this?\nDidn't anyone ever tell you web-page hit counters were useless? They\ndon't count number of hits, they're a waste of time, and they serve only\nto stroke the writer's vanity. It's better to pick a random number;\nthey're more realistic.\n\nAnyway, this is what you can do if you can't help yourself.\n\nuse Fcntl qw(:DEFAULT :flock);\nsysopen my $fh, \"numfile\", ORDWR|OCREAT or die \"can't open numfile: $!\";\nflock $fh, LOCKEX                        or die \"can't flock numfile: $!\";\nmy $num = <$fh> || 0;\nseek $fh, 0, 0                            or die \"can't rewind numfile: $!\";\ntruncate $fh, 0                           or die \"can't truncate numfile: $!\";\n(print $fh $num+1, \"\\n\")                  or die \"can't write numfile: $!\";\nclose $fh                                 or die \"can't close numfile: $!\";\n\nHere's a much better web-page hit counter:\n\n$hits = int( (time() - 850000000) / rand(1000) );\n\nIf the count doesn't impress your friends, then the code might. :-)\n",
                "subsections": []
            },
            "Found in /usr/share/perl/5.34/pod/perlfaq7.pod": {
                "content": "Why can't a method included in this same file be found?\nSome possible reasons: your inheritance is getting confused, you've\nmisspelled the method name, or the object is of the wrong type. Check\nout perlootut for details about any of the above cases. You may also use\n\"print ref($object)\" to find out the class $object was blessed into.\n\nAnother possible reason for problems is that you've used the indirect\nobject syntax (eg, \"find Guru \"Samy\"\") on a class name before Perl has\nseen that such a package exists. It's wisest to make sure your packages\nare all defined before you start using them, which will be taken care of\nif you use the \"use\" statement instead of \"require\". If not, make sure\nto use arrow notation (eg., \"Guru->find(\"Samy\")\") instead. Object\nnotation is explained in perlobj.\n\nMake sure to read about creating modules in perlmod and the perils of\nindirect objects in \"Method Invocation\" in perlobj.\n",
                "subsections": []
            },
            "Found in /usr/share/perl/5.34/pod/perlfaq8.pod": {
                "content": "Where do I get the include files to do ioctl() or syscall()?\nHistorically, these would be generated by the h2ph tool, part of the\nstandard perl distribution. This program converts cpp(1) directives in C\nheader files to files containing subroutine definitions, like\n\"SYSgetitimer()\", which you can use as arguments to your functions. It\ndoesn't work perfectly, but it usually gets most of the job done. Simple\nfiles like errno.h, syscall.h, and socket.h were fine, but the hard ones\nlike ioctl.h nearly always need to be hand-edited. Here's how to install\nthe *.ph files:\n\n1. Become the super-user\n2. cd /usr/include\n3. h2ph *.h */*.h\n\nIf your system supports dynamic loading, for reasons of portability and\nsanity you probably ought to use h2xs (also part of the standard perl\ndistribution). This tool converts C header files to Perl extensions. See\nperlxstut for how to get started with h2xs.\n\nIf your system doesn't support dynamic loading, you still probably ought\nto use h2xs. See perlxstut and ExtUtils::MakeMaker for more information\n(in brief, just use make perl instead of a plain make to rebuild perl\nwith a new static extension).\n\nHow do I add a directory to my include path (@INC) at runtime?\nHere are the suggested ways of modifying your include path, including\nenvironment variables, run-time switches, and in-code statements:\n\nthe \"PERLLIB\" environment variable\n$ export PERLLIB=/path/to/my/dir\n$ perl program.pl\n\nthe \"PERL5LIB\" environment variable\n$ export PERL5LIB=/path/to/my/dir\n$ perl program.pl\n\nthe \"perl -Idir\" command line flag\n$ perl -I/path/to/my/dir program.pl\n\nthe \"lib\" pragma:\nuse lib \"$ENV{HOME}/myownperllib\";\n\nthe local::lib module:\nuse local::lib;\n\nuse local::lib \"~/myownperllib\";\n",
                "subsections": []
            }
        }
    }
}