'perlfaq' => {
'MAINTAINER' => 'perlfaq',
- 'DISTRIBUTION' => 'LLAP/perlfaq-5.0150043.tar.gz',
+ 'DISTRIBUTION' => 'LLAP/perlfaq-5.0150044.tar.gz',
'FILES' => q[cpan/perlfaq],
'EXCLUDED' => [
qw( t/release-pod-syntax.t
package perlfaq;
{
- $perlfaq::VERSION = '5.0150043';
+ $perlfaq::VERSION = '5.0150044';
}
0; # not is it supposed to be loaded
=item *
+How often are new versions of Perl released?
+
+=item *
+
Is Perl difficult to learn?
=item *
What does "bad interpreter" mean?
+=item *
+
+Do I need to recompile XS modules when there is a change in the C library?
+
=back
=item *
+Where are modules installed?
+
+=item *
+
What is socket.ph and where do I get it?
=back
There is often a matter of opinion and taste, and there isn't any one
answer that fits everyone. In general, you want to use either the current
stable release, or the stable release immediately prior to that one.
-Currently, those are perl5.14.x and perl5.12.x, respectively.
+Currently, those are perl5.18.x and perl5.16.x, respectively.
Beyond that, you have to consider several things and decide which is best
for you.
=item *
-The immediate, previous releases (i.e. perl5.8.x ) are usually maintained
+The immediate, previous releases (i.e. perl5.14.x ) are usually maintained
for a while, although not at the same level as the current releases.
=item *
There are really two tracks of perl development: a maintenance version
and an experimental version. The maintenance versions are stable, and
-have an even number as the minor release (i.e. perl5.10.x, where 10 is the
+have an even number as the minor release (i.e. perl5.18.x, where 18 is the
minor release). The experimental versions may include features that
don't make it into the stable versions, and have an odd number as the
-minor release (i.e. perl5.9.x, where 9 is the minor release).
+minor release (i.e. perl5.19.x, where 9 is the minor release).
=back
internal core of the language, but all possible efforts are made toward
backward compatibility.
+=head2 How often are new versions of Perl released?
+
+Recently, the plan has been to release a new version of Perl roughly every
+April, but getting the release right is more important than sticking rigidly to
+a calendar date, so the release date is somewhat flexible. The historical
+release dates can be viewed at L<http://www.cpan.org/src/README.html>.
+
+Even numbered minor versions (5.14, 5.16, 5.18) are production versions, and
+odd numbered minor versions (5.15, 5.17, 5.19) are development versions. Unless
+you want to try out an experimental feature, you probably never want to install
+a development version of Perl.
+
+The Perl development team are called Perl 5 Porters, and their
+organization is described at L<http://perldoc.perl.org/perlpolicy.html>.
+The organizational rules really just boil down to one: Larry is always
+right, even when he was wrong.
+
=head2 Is Perl difficult to learn?
No, Perl is easy to start L<learning|http://learn.perl.org/> --and easy to keep learning. It looks
L<http://kephra.sf.net>
-GUI Editor written in Perl using wxWidgets and Scintilla with lots of smaller features.
-Aims for an UI based on Perls principles like TIMTWTDI and "easy things should be ..".
+GUI editor written in Perl using wxWidgets and Scintilla with lots of smaller features.
+Aims for a UI based on Perl principles like TIMTOWTDI and "easy things should be easy,
+hard things should be possible".
=item Komodo
=head2 Where can I learn about object-oriented Perl programming?
-A good place to start is L<perltoot>, and you can use L<perlobj>,
-L<perlboot>, L<perltoot>, L<perltooc>, and L<perlbot> for reference.
+A good place to start is L<perlootut>, and you can use L<perlobj> for
+reference.
A good book on OO on Perl is the "Object-Oriented Perl"
by Damian Conway from Manning Publications, or "Intermediate Perl"
References are documented in L<perlref> and L<perlreftut>.
Examples of complex data structures are given in L<perldsc> and
L<perllol>. Examples of structures and object-oriented classes are
-in L<perltoot>.
+in L<perlootut>.
=head2 How can I use a reference as a hash key?
$person->{AGE} = 24; # set field AGE to 24
$person->{NAME} = "Nat"; # set field NAME to "Nat"
-If you're looking for something a bit more rigorous, try L<perltoot>.
+If you're looking for something a bit more rigorous, try L<perlootut>.
=head2 How do I create a module?
Detailed documentation about modules can be found at:
L<perlmod>, L<perlmodlib>, L<perlmodstyle>.
-If you need to include C code or C library interfaces
-use h2xs. h2xs will create the module distribution structure
+If you need to include C code or C library interfaces
+use h2xs. h2xs will create the module distribution structure
and the initial interface files.
L<perlxs> and L<perlxstut> explain the details.
just the way that you like it (that is, it doesn't set up anything for
you).
-The Perl documentation has several tutorials that cover class
-creation, including L<perlboot> (Barnyard Object Oriented Tutorial),
-L<perltoot> (Tom's Object Oriented Tutorial), L<perlbot> (Bag o'
-Object Tricks), and L<perlobj>.
+See also L<perlootut>, a tutorial that covers class creation, and L<perlobj>.
=head2 How can I tell if a variable is tainted?
in L<overload>.
If you're talking about obscuring method calls in parent classes,
-see L<perltoot/"Overridden Methods">.
+see L<perlootut/"Overriding methods and method resolution">.
=head2 What's the difference between calling a function as &foo and foo()?
list, C<@_>. Here's an example; the C<bar> subroutine calls C<&foo>,
which prints its arguments list:
- sub bar { &foo }
+ sub foo { print "Args in foo are: @_\n"; }
- sub foo { print "Args in foo are: @_\n" }
+ sub bar { &foo; }
- bar( qw( a b c ) );
+ bar( "a", "b", "c" );
When you call C<bar> with arguments, you see that C<foo> got the same C<@_>:
Args in foo are: a b c
Calling the subroutine with trailing parentheses, with or without arguments,
-does not use the current C<@_> and respects the subroutine prototype. Changing
-the example to put parentheses after the call to C<foo> changes the program:
+does not use the current C<@_>. Changing the example to put parentheses after
+the call to C<foo> changes the program:
- sub bar { &foo() }
+ sub foo { print "Args in foo are: @_\n"; }
- sub foo { print "Args in foo are: @_\n" }
+ sub bar { &foo(); }
- bar( qw( a b c ) );
+ bar( "a", "b", "c" );
Now the output shows that C<foo> doesn't get the C<@_> from its caller.
Args in foo are:
+However, using C<&> in the call still overrides the prototype of C<foo> if
+present:
+
+ sub foo ($$$) { print "Args infoo are: @_\n"; }
+
+ sub bar_1 { &foo; }
+ sub bar_2 { &foo(); }
+ sub bar_3 { foo( $_[0], $_[1], $_[2] ); }
+ # sub bar_4 { foo(); }
+ # bar_4 doesn't compile: "Not enough arguments for main::foo at ..."
+
+ bar_1( "a", "b", "c" );
+ # Args in foo are: a b c
+
+ bar_2( "a", "b", "c" );
+ # Args in foo are:
+
+ bar_3( "a", "b", "c" );
+ # Args in foo are: a b c
+
The main use of the C<@_> pass-through feature is to write subroutines
whose main job it is to call other subroutines for you. For further
details, see L<perlsub>.
=head2 How can I catch accesses to undefined variables, functions, or methods?
-The AUTOLOAD method, discussed in L<perlsub/"Autoloading"> and
-L<perltoot/"AUTOLOAD: Proxy Methods">, lets you capture calls to
-undefined functions and methods.
+The AUTOLOAD method, discussed in L<perlsub/"Autoloading"> lets you capture
+calls to undefined functions and methods.
When it comes to undefined variables that would trigger a warning
under C<use warnings>, you can promote the warning to an error.
Some possible reasons: your inheritance is getting confused, you've
misspelled the method name, or the object is of the wrong type. Check
-out L<perltoot> for details about any of the above cases. You may
+out L<perlootut> for details about any of the above cases. You may
also use C<print ref($object)> to find out the class C<$object> was
blessed into.
your PATH, which might also mean that the location of perl is not
where you expect it so you need to adjust your shebang line.
+=head2 Do I need to recompile XS modules when there is a change in the C library?
+
+(contributed by Alex Beamish)
+
+If the new version of the C library is ABI-compatible (that's Application
+Binary Interface compatible) with the version you're upgrading from, and if the
+shared library version didn't change, no re-compilation should be necessary.
+
=head1 AUTHOR AND COPYRIGHT
-Copyright (c) 1997-2010 Tom Christiansen, Nathan Torkington, and
+Copyright (c) 1997-2013 Tom Christiansen, Nathan Torkington, and
other authors as noted. All rights reserved.
This documentation is free; you can redistribute it and/or modify it
use IPC::Open3;
use File::Spec;
- use Symbol qw(gensym);
+ my $in = '';
open(NULL, ">", File::Spec->devnull);
- my $pid = open3(gensym, \*PH, ">&NULL", "cmd");
+ my $pid = open3($in, \*PH, ">&NULL", "cmd");
while( <PH> ) { }
waitpid($pid, 0);
use IPC::Open3;
use File::Spec;
- use Symbol qw(gensym);
+ my $in = '';
open(NULL, ">", File::Spec->devnull);
- my $pid = open3(gensym, ">&NULL", \*PH, "cmd");
+ my $pid = open3($in, ">&NULL", \*PH, "cmd");
while( <PH> ) { }
waitpid($pid, 0);
To capture a program's STDERR, and let its STDOUT go to our own STDERR:
use IPC::Open3;
- use Symbol qw(gensym);
- my $pid = open3(gensym, ">&STDERR", \*PH, "cmd");
+ my $in = '';
+ my $pid = open3($in, ">&STDERR", \*PH, "cmd");
while( <PH> ) { }
waitpid($pid, 0);
files:
use IPC::Open3;
- use Symbol qw(gensym);
use IO::File;
+ my $in = '';
local *CATCHOUT = IO::File->new_tmpfile;
local *CATCHERR = IO::File->new_tmpfile;
- my $pid = open3(gensym, ">&CATCHOUT", ">&CATCHERR", "cmd");
+ my $pid = open3($in, ">&CATCHOUT", ">&CATCHERR", "cmd");
waitpid($pid, 0);
seek $_, 0, 0 for \*CATCHOUT, \*CATCHERR;
while( <CATCHOUT> ) {}
should work just as well, without deadlocking:
use IPC::Open3;
- use Symbol qw(gensym);
+ my $in = '';
use IO::File;
local *CATCHERR = IO::File->new_tmpfile;
- my $pid = open3(gensym, \*CATCHOUT, ">&CATCHERR", "cmd");
+ my $pid = open3($in, \*CATCHOUT, ">&CATCHERR", "cmd");
while( <CATCHOUT> ) {}
waitpid($pid, 0);
seek CATCHERR, 0, 0;
architectures. The C<lib.pm> pragmatic module was first
included with the 5.002 release of Perl.
+=head2 Where are modules installed?
+
+Modules are installed on a case-by-case basis (as provided by the methods
+described in the previous section), and in the operating system. All of these
+paths are stored in @INC, which you can display with the one-liner
+
+ perl -e 'print join("\n",@INC,"")'
+
+The same information is displayed at the end of the output from the command
+
+ perl -V
+
+To find out where a module's source code is located, use
+
+ perldoc -l Encode
+
+to display the path to the module. In some cases (for example, the C<AutoLoader>
+module), this command will show the path to a separate C<pod> file; the module
+itself should be in the same directory, with a 'pm' file extension.
+
=head2 What is socket.ph and where do I get it?
It's a Perl 4 style file defining values for system networking
from basic file servers and small scale intranets to massive multinational
multilingual websites that are the core to international businesses.
-Below is a list of a few frameworks with comments which might help you in
+Below is a list of a few frameworks with comments which might help you in
making a decision, depending on your specific requirements. Start by reading
the docs, then ask questions on the relevant mailing list or IRC channel.
=item primary maintainer
-The X<primary maintainer>author that PAUSE allows to assign B<co-maintainer>
+The X<primary maintainer>author that PAUSE allows to assign B<co-maintainer>
permissions to a B<namespace>. A primary maintainer can give up this
distinction by assigning it to another PAUSE author. See Camel chapter 19,
“CPAN”.
=item *
+L<perlfaq> has been upgraded from version 5.0150043 to 5.0150044.
+
+The use of C<gensym> in a number of examples has been removed, the use of C<&>
+in subroutine calls is now clarified and several new questions have been
+answered.
+
+=item *
+
L<re> has been upgraded from version 0.25 to 0.26.
A function signature has been corrected in the XS implementation.