=head2 How do I find out which operating system I'm running under?
-The C<$^O> variable (C<$OSNAME> if you use C<English>) contains an indication of
-the name of the operating system (not its release number) that your perl
-binary was built for.
+The C<$^O> variable (C<$OSNAME> if you use C<English>) contains an
+indication of the name of the operating system (not its release
+number) that your perl binary was built for.
=head2 How come exec() doesn't return?
X<exec> X<system> X<fork> X<open> X<pipe>
=back
-While trying to read from his caller-id box, the notorious Jamie Zawinski
-C<< <jwz@netscape.com> >>, after much gnashing of teeth and fighting with C<sysread>,
-C<sysopen>, POSIX's C<tcgetattr> business, and various other functions that
-go bump in the night, finally came up with this:
+While trying to read from his caller-id box, the notorious Jamie
+Zawinski C<< <jwz@netscape.com> >>, after much gnashing of teeth and
+fighting with C<sysread>, C<sysopen>, POSIX's C<tcgetattr> business,
+and various other functions that go bump in the night, finally came up
+with this:
sub open_modem {
use IPC::Open2;
and many of the techniques are in L<perlipc>.
Several CPAN modules may be able to help, including C<IPC::Open2> or
-C<IPC::Open3>, C<IPC::Run>, C<Parallel::Jobs>, C<Parallel::ForkManager>, C<POE>,
-C<Proc::Background>, and C<Win32::Process>. There are many other modules you
-might use, so check those namespaces for other options too.
+C<IPC::Open3>, C<IPC::Run>, C<Parallel::Jobs>,
+C<Parallel::ForkManager>, C<POE>, C<Proc::Background>, and
+C<Win32::Process>. There are many other modules you might use, so
+check those namespaces for other options too.
If you are on a Unix-like system, you might be able to get away with a
system call where you put an C<&> on the end of the command:
use sigtrap qw(die normal-signals);
-Perl's exception-handling mechanism is its C<eval()> operator. You can
-use C<eval()> as C<setjmp> and C<die()> as C<longjmp>. For details of this, see
-the section on signals, especially the time-out handler for a blocking
-C<flock()> in L<perlipc/"Signals"> or the section on "Signals" in
-the Camel Book.
+Perl's exception-handling mechanism is its C<eval()> operator. You
+can use C<eval()> as C<setjmp> and C<die()> as C<longjmp>. For
+details of this, see the section on signals, especially the time-out
+handler for a blocking C<flock()> in L<perlipc/"Signals"> or the
+section on "Signals" in the Camel Book.
If exception handling is all you're interested in, try the
C<exceptions.pl> library (part of the standard perl distribution).
=head2 How can I open a pipe both to and from a command?
-The C<IPC::Open2> module (part of the standard perl distribution) is an
-easy-to-use approach that internally uses C<pipe()>, C<fork()>, and C<exec()>
-to do the job. Make sure you read the deadlock warnings in its documentation,
-though (see L<IPC::Open2>). See
+The C<IPC::Open2> module (part of the standard perl distribution) is
+an easy-to-use approach that internally uses C<pipe()>, C<fork()>, and
+C<exec()> to do the job. Make sure you read the deadlock warnings in
+its documentation, though (see L<IPC::Open2>). See
L<perlipc/"Bidirectional Communication with Another Process"> and
L<perlipc/"Bidirectional Communication with Yourself">
=head2 Can I use perl to run a telnet or ftp session?
-Try the C<Net::FTP>, C<TCP::Client>, and C<Net::Telnet> modules (available from
-CPAN). http://www.cpan.org/scripts/netstuff/telnet.emul.shar
-will also help for emulating the telnet protocol, but C<Net::Telnet> is
-quite probably easier to use.
+Try the C<Net::FTP>, C<TCP::Client>, and C<Net::Telnet> modules
+(available from CPAN).
+http://www.cpan.org/scripts/netstuff/telnet.emul.shar will also help
+for emulating the telnet protocol, but C<Net::Telnet> is quite
+probably easier to use.
If all you want to do is pretend to be telnet but don't need
the initial telnet handshaking, then the standard dual-process
(contributed by brian d foy)
This is a difficult question to answer, and the best answer is
-only a guess. What do you really want to know? If you merely
-want to know if one of your filehandles is connected to a terminal,
-you can try the C<-t> file test:
+only a guess.
+
+What do you really want to know? If you merely want to know if one of
+your filehandles is connected to a terminal, you can try the C<-t>
+file test:
if( -t STDOUT ) {
print "I'm connected to a terminal!\n";
available drivers on CPAN: http://www.cpan.org/modules/by-module/DBD/ .
You can read more about DBI on http://dbi.perl.org .
-Other modules provide more specific access: C<Win32::ODBC>, C<Alzabo>, C<iodbc>,
-and others found on CPAN Search: http://search.cpan.org .
+Other modules provide more specific access: C<Win32::ODBC>, C<Alzabo>,
+C<iodbc>, and others found on CPAN Search: http://search.cpan.org .
=head2 How do I make a system() exit on control-C?
perl Makefile.PL INSTALL_BASE=/mydir/perl
-You can set this in your C<CPAN.pm> configuration so modules automatically install
-in your private library directory when you use the CPAN.pm shell:
+You can set this in your C<CPAN.pm> configuration so modules
+automatically install in your private library directory when you use
+the CPAN.pm shell:
% cpan
cpan> o conf makepl_arg INSTALL_BASE=/mydir/perl
You can configure C<CPAN.pm> to automatically use this option too:
% cpan
- cpan> o conf mbuild_arg --install_base /mydir/perl
+ cpan> o conf mbuild_arg "--install_base /mydir/perl"
cpan> o conf commit
INSTALL_BASE tells these tools to put your modules into
constants. Sometimes it is built using C<h2ph> when Perl is installed,
but other times it is not. Modern programs C<use Socket;> instead.
-=head1 REVISION
-
-Revision: $Revision$
-
-Date: $Date$
-
-See L<perlfaq> for source control details and availability.
-
=head1 AUTHOR AND COPYRIGHT
-Copyright (c) 1997-2009 Tom Christiansen, Nathan Torkington, and
+Copyright (c) 1997-2010 Tom Christiansen, Nathan Torkington, and
other authors as noted. All rights reserved.
This documentation is free; you can redistribute it and/or modify it