# inc - perldoc - phpman

## Found in /usr/share/perl/5.34/pod/perlfaq1.pod
  How can I convince others to use Perl?
    (contributed by brian d foy)

    Appeal to their self interest! If Perl is new (and thus scary) to them,
    find something that Perl can do to solve one of their problems. That
    might mean that Perl either saves them something (time, headaches,
    money) or gives them something (flexibility, power, testability).

    In general, the benefit of a language is closely related to the skill of
    the people using that language. If you or your team can be faster,
    better, and stronger through Perl, you'll deliver more value. Remember,
    people often respond better to what they get out of it. If you run into
    resistance, figure out what those people get out of the other choice and
    how Perl might satisfy that requirement.

    You don't have to worry about finding or paying for Perl; it's freely
    available and several popular operating systems come with Perl.
    Community support in places such as Perlmonks (
    <<http://www.perlmonks.com>> ) and the various Perl mailing lists (
    <<http://lists.perl.org>> ) means that you can usually get quick answers
    to your problems.

    Finally, keep in mind that Perl might not be the right tool for every
    job. You're a much better advocate if your claims are reasonable and
    grounded in reality. Dogmatically advocating anything tends to make
    people discount your message. Be honest about possible disadvantages to
    your choice of Perl since any choice has trade-offs.

    You might find these links useful:

    *   <<http://www.perl.org/about.html>>

    *   <<http://perltraining.com.au/whyperl.html>>

## Found in /usr/share/perl/5.34/pod/perlfaq4.pod
  Why don't my tied hashes make the defined/exists distinction?
    This depends on the tied hash's implementation of EXISTS(). For example,
    there isn't the concept of undef with hashes that are tied to DBM*
    files. It also means that exists() and defined() do the same thing with
    a DBM* file, and what they end up doing is not what they do with
    ordinary hashes.

## Found in /usr/share/perl/5.34/pod/perlfaq5.pod
  I still don't get locking. I just want to increment the number in the file. How can I do this?
    Didn't anyone ever tell you web-page hit counters were useless? They
    don't count number of hits, they're a waste of time, and they serve only
    to stroke the writer's vanity. It's better to pick a random number;
    they're more realistic.

    Anyway, this is what you can do if you can't help yourself.

        use Fcntl qw(:DEFAULT :flock);
        sysopen my $fh, "numfile", O_RDWR|O_CREAT or die "can't open numfile: $!";
        flock $fh, LOCK_EX                        or die "can't flock numfile: $!";
        my $num = <$fh> || 0;
        seek $fh, 0, 0                            or die "can't rewind numfile: $!";
        truncate $fh, 0                           or die "can't truncate numfile: $!";
        (print $fh $num+1, "\n")                  or die "can't write numfile: $!";
        close $fh                                 or die "can't close numfile: $!";

    Here's a much better web-page hit counter:

        $hits = int( (time() - 850_000_000) / [rand(1_000)](https://www.chedong.com/phpMan.php/man/rand/1000/markdown) );

    If the count doesn't impress your friends, then the code might. :-)

## Found in /usr/share/perl/5.34/pod/perlfaq7.pod
  Why can't a method included in this same file be found?
    Some possible reasons: your inheritance is getting confused, you've
    misspelled the method name, or the object is of the wrong type. Check
    out perlootut for details about any of the above cases. You may also use
    "print ref($object)" to find out the class $object was blessed into.

    Another possible reason for problems is that you've used the indirect
    object syntax (eg, "find Guru "Samy"") on a class name before Perl has
    seen that such a package exists. It's wisest to make sure your packages
    are all defined before you start using them, which will be taken care of
    if you use the "use" statement instead of "require". If not, make sure
    to use arrow notation (eg., "Guru->find("Samy")") instead. Object
    notation is explained in perlobj.

    Make sure to read about creating modules in perlmod and the perils of
    indirect objects in "Method Invocation" in perlobj.

## Found in /usr/share/perl/5.34/pod/perlfaq8.pod
  Where do I get the include files to do ioctl() or syscall()?
    Historically, these would be generated by the h2ph tool, part of the
    standard perl distribution. This program converts [cpp(1)](https://www.chedong.com/phpMan.php/man/cpp/1/markdown) directives in C
    header files to files containing subroutine definitions, like
    "SYS_getitimer()", which you can use as arguments to your functions. It
    doesn't work perfectly, but it usually gets most of the job done. Simple
    files like errno.h, syscall.h, and socket.h were fine, but the hard ones
    like ioctl.h nearly always need to be hand-edited. Here's how to install
    the *.ph files:

        1. Become the super-user
        2. cd /usr/include
        3. h2ph *.h */*.h

    If your system supports dynamic loading, for reasons of portability and
    sanity you probably ought to use h2xs (also part of the standard perl
    distribution). This tool converts C header files to Perl extensions. See
    perlxstut for how to get started with h2xs.

    If your system doesn't support dynamic loading, you still probably ought
    to use h2xs. See perlxstut and [ExtUtils::MakeMaker](https://www.chedong.com/phpMan.php/perldoc/ExtUtils%3A%3AMakeMaker/markdown) for more information
    (in brief, just use make perl instead of a plain make to rebuild perl
    with a new static extension).

  How do I add a directory to my include path (@INC) at runtime?
    Here are the suggested ways of modifying your include path, including
    environment variables, run-time switches, and in-code statements:

    the "PERLLIB" environment variable
            $ export PERLLIB=/path/to/my/dir
            $ perl program.pl

    the "PERL5LIB" environment variable
            $ export PERL5LIB=/path/to/my/dir
            $ perl program.pl

    the "perl -Idir" command line flag
            $ perl -I/path/to/my/dir program.pl

    the "lib" pragma:
            use lib "$ENV{HOME}/myown_perllib";

    the [local::lib](https://www.chedong.com/phpMan.php/perldoc/local%3A%3Alib/markdown) module:
            use [local::lib](https://www.chedong.com/phpMan.php/perldoc/local%3A%3Alib/markdown);

            use [local::lib](https://www.chedong.com/phpMan.php/perldoc/local%3A%3Alib/markdown) "~/myown_perllib";

