Andrew Hudson - Fedora™ Unleashed, 2008 edition

Здесь есть возможность читать онлайн «Andrew Hudson - Fedora™ Unleashed, 2008 edition» весь текст электронной книги совершенно бесплатно (целиком полную версию без сокращений). В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Город: Indianapolis, Год выпуска: 2008, ISBN: 2008, Издательство: Sams Publishing, Жанр: ОС и Сети, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.

Fedora™ Unleashed, 2008 edition: краткое содержание, описание и аннотация

Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Fedora™ Unleashed, 2008 edition»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.

Quick Glance Guide
Finding information you need is not always easy. This short index provides a list of common tasks discussed inside this book. Browse the table of contents or index for detailed listings and consult the specified chapter for in-depth discussions about each subject.
left How Do I…?
See…
How Do I…?
See…
left Back up my system?
Chapter 13
Partition a hard drive?
Appendix B, Chapters 1, 35
left Build a new Linux kernel?
Chapter 36
Play MP3s and other music?
Chapter 7
left Burn a CD?
Chapter 7
Print a file?
Chapter 8
left Change a password?
Chapter 4
Read a text file?
Chapter 4
left Change the date and time?
Chapter 32
Read or send email?
Chapter 21
left Compress a file?
Chapter 13
Read or post to newsgroups?
Chapter 5
left Configure a modem?
Chapter 2
Reboot Fedora?
Chapter 1
left Configure a printer?
Chapter 8
Rescue my system?
Chapter 13
left Configure a scanner?
Chapter 7
Set up a DNS server?
Chapter 23
left Configure a sound card?
Chapter 7
Set up a firewall?
Chapter 14
left Configure my desktop settings?
Chapter 3
Set up a web server?
Chapter 15
left Connect to the Internet?
Chapter 5
Set up an FTP server?
Chapter 20
left Control a network interface?
Chapter 14
Set up Samba with SWAT?
Chapter 19
left Copy files or directories?
Chapters 13, 32
Set up wireless networking?
Chapter 14
left Create a boot disk to boot Fedora?
Chapter 1
Shut down Fedora?
Chapter 1
left Create a database?
Chapter 16
Use a spreadsheet?
Chapter 6
left Create a user?
Chapter 4
Use Instant Messaging?
Chapter 5
left Delete a file or directory?
Chapter 32
Watch television on my computer?
Chapter 7
left Get images from a digital camera?
Chapter 7
Edit a text file?
Chapter 4
left Install Fedora?
Chapter 1
Make Fedora more secure?
Chapter 14
left Log in to Fedora?
Chapter 1
Mount a CD-ROM or hard drive?
Chapter 35

Fedora™ Unleashed, 2008 edition — читать онлайн бесплатно полную книгу (весь текст) целиком

Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Fedora™ Unleashed, 2008 edition», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.

Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Access to the Shell

Perl can perform any process you might ordinarily perform if you type commands to the shell through the ``syntax. For example, the code in Listing 25.4 prints a directory listing.

LISTING 25.4 Using Backticks to Access the Shell

$curr_dir = `pwd`;

@listing = `ls -al`;

print "Listing for $curr_dir\n";

foreach $file (@listing) {

print "$file";

}

NOTE

The ``notation uses the backtick found above the Tab key (on most keyboards), not the single quotation mark.

You can also use the Shellmodule to access the shell. Shellis one of the standard modules that comes with Perl; it allows creation and use of a shell-like command line. Look at the following code for an example:

use Shell qw(cp);

cp ("/home/httpd/logs/access.log", "/tmp/httpd.log");

This code almost looks as if it is importing the command-line functions directly into Perl. Although that is not really happening, you can pretend that the code is similar to a command line and use this approach in your Perl programs.

A third method of accessing the shell is via the systemfunction call:

$rc = 0xffff & system('cp /home/httpd/logs/access.log /tmp/httpd.log');

if ($rc == 0) {

print "system cp succeeded \n";

} else {

print "system cp failed $rc\n";

}

The call can also be used with the or dieclause:

system('cp /home/httpd/logs/access.log /tmp/httpd.log') == 0

or die "system cp failed: $?"

However, you can't capture the output of a command executed through the systemfunction.

Modules and CPAN

A great strength of the Perl community (and the Linux community) is that it is an open source community. This community support is expressed for Perl via CPAN, which is a network of mirrors of a repository of Perl code.

Most of CPAN is made up of modules , which are reuseable chunks of code that do useful things, similar to software libraries containing functions for C programmers. These modules help speed development when building Perl programs and free Perl hackers from repeatedly reinventing the wheel when building a bicycle.

Perl comes with a set of standard modules installed. Those modules should contain much of the functionality that you will initially need with Perl. If you need to use a module not installed with Fedora, use the CPAN module (which is one of the standard modules) to download and install other modules onto your system. At http://www.perl.com/CPAN, you will find the CPAN Multiplex Dispatcher, which attempts to direct you to the CPAN site closest to you.

Typing the following command puts you into an interactive shell that gives you access to CPAN. You can type help at the prompt to get more information on how to use the CPAN program.

$ perl -MCPAN -e shell

After you have installed a module from CPAN (or written one of your own), you can load that module into memory, where you can use it with the usefunction:

use Time::CTime;

uselooks in the directories listed in the variable @INCfor the module. In this example, uselooks for a directory called Time, which contains a file called CTime.pm, which in turn is assumed to contain a package called Time::CTime. The distribution of each module should contain documentation on using that module.

For a list of all the standard Perl modules (those that come with Perl when you install it), see perlmodlibin the Perl documentation. You can read this document by typing perldoc perlmodlib at the command prompt.

Related Fedora and Linux Commands

You will use these commands and tools when using Perl with Linux:

a2p — A filter used to translate awkscripts into Perl

find2perl — A utility used to create Perl code from command lines, using the find command

pcregrep — A utility used to search data, using Perl-compatible regular expressions

perlcc — A compiler for Perl programs

perldoc — A Perl utility used to read Perl documentation

s2p — A filter used to translate sedscripts into Perl

vi — The vi(actually vim) text editor

Reference

http://www.perl.com/— Tom Christiansen maintains the Perl language home page. This is the place to find all sorts of information about Perl, from its history and culture to helpful tips. This is also the place to download the Perl interpreter for your system.

http://www.perl.com/CPAN— This is part of the site just mentioned, but it merits its own mention. CPAN (Comprehensive Perl Archive Network) is the place for you to find modules and programs in Perl. If you write something in Perl that you think is particularly useful, you can make it available to the Perl community here.

http://www.perl.eom/pub/q/FAQs— Frequently Asked Questions index of common Perl queries; this site offers a handy way to quickly search for answers about Perl.

http://learn.perl.org/— One of the best places to start learning Perl online. If you master Perl, go to http://jobs.perl.org.

http://www.pm.org/— The Perl Mongers are local Perl users groups. There might be one in your area. The Perl advocacy site ishttp://www.perl.org/.

http://www.tpj.com/The Perl Journal is "a reader-supported monthly e-zine" devoted to the Perl programming language. TPJ is always full of excellent, amusing, and informative articles, and is an invaluable resource to both new and experienced Perl programmers.

http://www-106.ibm.com/developerworks/linux/library/l-p101— A short tutorial about one-line Perl scripts and code.

Books

Advanced Perl Programming , by Sriram Srinivasan, O'Reilly & Associates.

Sams Teach Yourself Perl in 21 Days , Second Edition, by Laura Lemay, Sams Publishing.

Learning Perl, Third Edition , by Randal L. Schwartz, Tom Phoenix, O'Reilly & Associates.

Programming Perl, Third Edition , by Larry Wall, Tom Christiansen, and Jon Orwant, O'Reilly & Associates.

CHAPTER 26

Working with Python

As PHP has come to dominate the world of web scripting, Python is increasingly dominating the domain of command-line scripting. Python's precise and clean syntax makes it one of the easiest languages to learn, and it enables programmers to code more quickly and spend less time maintaining their code. Although PHP is fundamentally similar to Java and Perl, Python is closer to C and Modula-3, and so it might look unfamiliar at first.

Most other languages have a group of developers at their cores, but Python has Guido van Rossum — creator, father, and Benevolent Dictator For Life (BDFL). Although Guido spends less time working on Python now, he still essentially has the right to veto changes to the language, which has enabled it to remain consistent over the many years of its development. The end result is that, in Guido's own words, "Even if you are in fact clueless about language design, you can tell that Python is a very simple language."

Читать дальше
Тёмная тема
Сбросить

Интервал:

Закладка:

Сделать

Похожие книги на «Fedora™ Unleashed, 2008 edition»

Представляем Вашему вниманию похожие книги на «Fedora™ Unleashed, 2008 edition» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.


Отзывы о книге «Fedora™ Unleashed, 2008 edition»

Обсуждение, отзывы о книге «Fedora™ Unleashed, 2008 edition» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.

x