Muutke küpsiste eelistusi

Perl by Example 5th edition [Pehme köide]

  • Formaat: Paperback / softback, 888 pages, kõrgus x laius x paksus: 233x179x44 mm, kaal: 1343 g
  • Ilmumisaeg: 24-Dec-2014
  • Kirjastus: Prentice Hall
  • ISBN-10: 0133760812
  • ISBN-13: 9780133760811
Teised raamatud teemal:
  • Pehme köide
  • Hind: 59,94 €*
  • * saadame teile pakkumise kasutatud raamatule, mille hind võib erineda kodulehel olevast hinnast
  • See raamat on trükist otsas, kuid me saadame teile pakkumise kasutatud raamatule.
  • Kogus:
  • Lisa ostukorvi
  • Tasuta tarne
  • Lisa soovinimekirja
  • Formaat: Paperback / softback, 888 pages, kõrgus x laius x paksus: 233x179x44 mm, kaal: 1343 g
  • Ilmumisaeg: 24-Dec-2014
  • Kirjastus: Prentice Hall
  • ISBN-10: 0133760812
  • ISBN-13: 9780133760811
Teised raamatud teemal:

The World’s Easiest Perl 5 Tutorial—Updated for Today’s Applications and “Modern Perl” Best Practices

“When I look at my bookshelf, I see eleven books on Perl programming.Perl by Example, Third Edition, isn’t on the shelf; it sits on my desk, where I use it almost daily. I still think it is the best Perl book on the market for anyone—beginner or seasoned programmer—who uses Perl daily.”

Bill Maples, Enterprise Network Support, Fidelity National Information Services

Perl by Example, Fifth Edition, is the proven, easy way to master Perl 5 programming. Legendary Silicon Valley programming instructor Ellie Quigley has fully updated and focused her classic text on today’s key Perl applications, especially automation, testing, data extraction, and legacy code maintenance. She has also revised this edition to reflect “modern Perl” practices that have emerged since Perl 5.10.

Quigley illuminates every technique with focused, classroom-tested code examples. For each example, she shows you code, input, and output, and provides detailed, line-by-line explanations of how the code generates that output. And her coverage is comprehensive, from basic syntax to regular expression handling, files, references, objects, working with databases, and much more…plusappendices that contain a complete list of functions and definitions, command-line switches, special variables, and popular modules.

New in This Edition

• Modern Perl approaches to using data types, operators, conditions, subroutines, packages, modules, references, pointers, files, objects, and more

• Many new examples, covering automation, testing, and data extraction

• A tutorial on writing object-oriented Perl with the Moose object system

• An introduction to Dancer, a powerful web application framework designed to replace CGI

• Updated code examples throughout

More than 50,000 sysadmins, power users, and developers have used this book’s previous editions to become expert Perl programmers, and you can, too–even if you’re completely new to Perl. Then, once you’re an expert, you’ll routinely return to this practical guide as the best source for reliable answers, solutions, and code. A more focused, quicker read than ever, this clear and practical guide will take you from your first Perl script to advanced applications. It’s the only Perl text you’ll need.

Ellie Quigley has taught scripting in Silicon Valley for more than twenty-five years. Her Perl and shell programming classes at the University of California, Santa Cruz Extension are part of Silicon Valley lore. Her other best-selling Prentice Hall books include UNIX® Shells by Example, Fourth Edition;PHP and MySQL by Example (with Marko Gargenta); and JavaScript by Example. A major player in developing UCSC’s Silicon Valley Extension program, she has created and customized courses for pioneering firms, including Xilinx, NetApp, Yahoo, and Juniper.

Arvustused

Praise for Ellie Quigleys Books

 

I picked up a copy of JavaScript by Example over the weekend and wanted to thank you for putting out a book that makes JavaScript easy to understand. Ive been a developer for several years now and JS has always been the monster under the bed, so to speak. Your book has answered a lot of questions Ive had about the inner workings of JS but was afraid to ask. Now all I need is a book that covers Ajax and Coldfusion. Thanks again for putting together an outstanding book.

Chris Gomez, Web services manager, Zunch Worldwide, Inc.

 

I have been reading your UNIX® Shells by Example book, and I must say, it is brilliant. Most other books do not cover all the shells, and when you have to constantly work in an organization that uses tcsh, bash, and korn, it can become very difficult. However, your book has been indispensable to me in learning the various shells and the differences between themso I thought Id email you, just to let you know what a great job you have done!

Farogh-Ahmed Usmani, B.Sc. (Honors), M.Sc., DIC, project consultant (Billing Solutions), Comverse

 

I have been learning Perl for about two months now; I have a little shell scripting experience but that is it. I first started with Learning Perl by OReilly. Good book but lacking on the examples. I then went to Programming Perl by Larry Wall, a great book for intermediate to advanced, didnt help me much beginning Perl. I then picked up Perl by Example, Third Editionthis book is a superb, well-written programming book. I have read many computer books and this definitely ranks in the top two, in my opinion. The examples are excellent. The author shows you the code, the output of each line, and then explains each line in every example.

Dan Patterson, software engineer, GuideWorks, LLC

 

Ellie Quigley has written an outstanding introduction to Perl, which I used to learn the language from scratch. All one has to do is work through her examples, putz around with them, and before long, youre relatively proficient at using the language. Even though Ive graduated to using Programming Perl by Wall et al., I still find Quigleys book a most useful reference.

Casey Machula, support systems analyst, Northern Arizona University, College of Health and Human Services

 

When I look at my bookshelf, I see eleven books on Perl programming. Perl by Example, Third Edition, isnt on the shelf; it sits on my desk, where I use it almost daily. When I bought my copy I had not programmed in several years and my programming was mostly in COBOL so I was a rank beginner at Perl. I had at that time purchased several popular books on Perl but nothing that really put it together for me. I am still no pro, but my book has many dog-eared pages and each one is a lesson I have learned and will certainly remember.

 

I still think it is the best Perl book on the market for anyone from a beginner to a seasoned programmer using Perl almost daily.

Bill Maples, network design tools and automations analyst, Fidelity National Information Services

 

We are rewriting our intro to OS scripting course and selected your text for the course. [ UNIX® Shells by Example is] an exceptional book. The last time we considered it was a few years ago (second edition). The debugging and system administrator chapters at the end nailed it for us.

Jim Leone, Ph.D., professor and chair, Information Technology, Rochester Institute of Technology

 

Quigleys [ PHP and MySQL by Example] acknowledges a major usage of PHP. To write some kind of front end user interface program that hooks to a back end MySQL database. Both are free and open source, and the combination has proved popular. Especially where the front end involves making an HTML web page with embedded PHP commands.

 

Not every example involves both PHP and MySQL. Though all examples have PHP. Many demonstrate how to use PHP inside an HTML file. Like writing user-defined functions, or nesting functions. Or making or using function libraries. The functions are a key idea in PHP, that take you beyond the elementary syntax. Functions also let you gainfully use code by other PHP programmers. Important if you are part of a coding group that has to divide up the programming effort in some manner.

Dr. Wes Boudville, CTO, Metaswarm Inc.

Preface xxv
1 The Practical Extraction and Report Language 1(14)
1.1 What Is Perl?
1(1)
1.2 What Is an Interpreted Language?
2(1)
1.3 Who Uses Perl?
3(3)
1.3.1 Which Perl?
4(1)
1.3.2 What Are Perl 6, Rakudo Perl, and Parrot?
4(2)
1.4 Where to Get Perl
6(3)
1.4.1 CPAN (cpan.org)
6(1)
1.4.2 Downloads and Other Resources for Perl (perl.org)
7(1)
1.4.3 ActivePerl (activestate.com)
8(1)
1.4.4 What Version Do I Have?
9(1)
1.5 Perl Documentation
9(4)
1.5.1 Where to Find the Most Complete Documentation from Perl
9(1)
1.5.2 Perl man Pages
10(2)
1.5.3 Online Documentation
12(1)
1.6 What You Should Know
13(1)
1.7 What's Next?
13(2)
2 Perl Quick Start 15(18)
2.1 Quick Start, Quick Reference
15(17)
2.1.1 A Note to Programmers
15(1)
2.1.2 A Note to Non-Programmers
15(1)
2.1.3 Perl Syntax and Constructs
15(18)
Regular Expressions
28(1)
Passing Arguments at the Command Line
29(1)
References and Pointers
29(1)
Objects
30(1)
Libraries and Modules
31(1)
Diagnostics
31(1)
2.2
Chapter Summary
32(1)
2.3 What's Next?
32(1)
3 Perl Scripts 33(16)
3.1 Getting Started
33(4)
3.1.1 Finding a Text Editor
34(1)
3.1.2 Naming Perl Scripts
35(1)
3.1.3 Statements, Whitespace, and Linebreaks
35(1)
3.1.4 Strings and Numbers
36(1)
3.2 Filehandles
37(1)
3.3 Variables (Where to Put Data)
37(5)
3.3.1 What Is Context?
38(1)
3.3.2 Comments
38(1)
3.3.3 Perl Statements
39(1)
3.3.4 Using Perl Built-in Functions
39(1)
3.3.5 Script Execution
40(2)
3.4 Summing It Up
42(2)
3.4.1 What Kinds of Errors to Expect
43(1)
3.5 Perl Switches
44(3)
3.5.1 The -e Switch (Quick Test at the Command Line)
45(1)
3.5.2 The -c Switch (Check Syntax)
46(1)
3.5.3 The -w Switch (Warnings)
46(1)
3.6 What You Should Know
47(1)
3.7 What's Next?
47(1)
Exercise 3 Getting with It Syntactically
48(1)
4 Getting a Handle on Printing 49(32)
4.1 The Special Filehandles STDOUT, STDIN, STDERR
49(2)
4.2 Words
51(1)
4.3 The print Function
51(18)
4.3.1 Quotes Matter!
52(7)
Double Quotes
53(1)
Single Quotes
54(1)
Backquotes
54(1)
Perl's Alternative Quotes
55(4)
4.3.2 Literals (Numeric, String, and Special)
59(7)
Numeric Literals
60(1)
String Literals
61(2)
Special Literals
63(3)
4.3.3 Printing Without Quotes—The here document
66(3)
here documents and CGI
67(2)
4.4 Fancy Formatting with the printf Function
69(5)
4.4.1 Saving Formatting with the sprintf Function
73(1)
4.4.2 The No Newline say Function
73(1)
4.5 What Are Pragmas?
74(4)
4.5.1 The feature Pragma
74(1)
4.5.2 The warnings Pragma
75(1)
4.5.3 The diagnostics Pragma
76(1)
4.5.4 The strict Pragma and Words
77(1)
4.6 What You Should Know
78(1)
4.7 What's Next?
79(1)
Exercise 4 A String of Perk
79(2)
5 What's In a Name? 81(64)
5.1 More About Data Types
81(6)
5.1.1 Basic Data Types (Scalar, Array, Hash)
81(1)
5.1.2 Package, Scope, Privacy, and Strictness
82(3)
Package and Scope
82(3)
5.1.3 Naming Conventions
85(1)
5.1.4 Assignment Statements
86(1)
5.2 Scalars, Arrays, and Hashes
87(18)
5.2.1 Scalar Variables
88(3)
Assignment
88(1)
The defined Function
89(1)
The undef Function
89(1)
The $_Scalar Variable
90(1)
5.2.2 Arrays
91(8)
Assignment
92(1)
Output and Input Special Variables ($, and $")
93(1)
Array Size
94(1)
The Range Operator and Array Assignment
95(1)
Accessing Elements
95(2)
Looping Through an Array with the foreach Loop
97(1)
Array Copy and Slices
98(1)
Multidimensional Arrays-Lists of Lists
99(1)
5.2.3 Hashes-Unordered Lists
99(5)
Assignment
100(1)
Accessing Hash Values
101(1)
Hash Slices
102(1)
Removing Duplicates from a List Using a Hash
103(1)
5.2.4 Complex Data Structures
104(1)
5.3 Array Functions
105(20)
5.3.1 Adding Elements to an Array
105(1)
The push Function
105(1)
The unshift Function
106(1)
5.3.2 Removing and Replacing Elements
106(5)
The delete Function
106(1)
The splice Function
107(2)
The pop Function
109(1)
The shift Function
110(1)
5.3.3 Deleting Newlines
111(1)
The chop and chomp Functions (with Lists)
111(1)
5.3.4 Searching for Elements and Index Values
112(2)
The grep Function
112(2)
5.3.5 Creating a List from a Scalar
114(4)
The split Function
114(4)
5.3.6 Creating a Scalar from a List
118(1)
The join Function
118(1)
5.3.7 Transforming an Array
119(2)
The map Function
119(2)
5.3.8 Sorting an Array
121(3)
The sort Function
121(3)
5.3.9 Checking the Existence of an Array Index Value
124(1)
The exists Function
124(1)
5.3.10 Reversing an Array
125(1)
The reverse Function
125(1)
5.4 Hash (Associative Array) Functions
125(15)
5.4.1 The keys Function
125(1)
5.4.2 The values Function
126(2)
5.4.3 The each Function
128(1)
5.4.4 Removing Duplicates from a List with a Hash
129(1)
5.4.5 Sorting a Hash by Keys and Values
130(5)
Sort Hash by Keys in Ascending Order
130(1)
Sort Hash by Keys in Reverse Order
131(1)
Sort Hash by Keys Numerically
132(1)
Numerically Sort a Hash by Values in Ascending Order
133(1)
Numerically Sort a Hash by Values in Descending Order
134(1)
5.4.6 The delete Function
135(1)
5.4.7 The exists function
136(1)
5.4.8 Special Hashes
137(2)
The %ENV Hash
137(1)
The %SIG Hash
138(1)
The %INC Hash
139(1)
5.4.9 Context Revisited
139(1)
5.5 What You Should Know
140(1)
5.6 What's Next?
141(1)
Exercise 5 The Funny Characters
141(4)
6 Where's the Operator? 145(36)
6.1 About Perl Operators—More Context
145(3)
6.1.1 Evaluating an Expression
147(1)
6.2 Mixing Types
148(1)
6.3 Precedence and Associativity
149(29)
6.3.1 Assignment Operators
151(2)
6.3.2 Boolean
153(1)
6.3.3 Relational Operators
154(2)
Numeric
154(1)
String
155(1)
6.3.4 Conditional Operators
156(1)
6.3.5 Equality Operators
157(3)
Numeric
157(2)
String
159(1)
6.3.6 The Smartmatch Operator
160(2)
6.3.7 Logical Operators (Short-Circuit Operators)
162(2)
6.3.8 Logical Word Operators
164(2)
6.3.9 Arithmetic Operators and Functions
166(6)
Arithmetic Operators
166(1)
Arithmetic Functions
167(5)
6.3.10 Autoincrement and Autodecrement Operators
172(1)
6.3.11 Bitwise Logical Operators
173(2)
A Little Bit About Bits
173(1)
Bitwise Operators
174(1)
6.3.12 Range Operator
175(1)
6.3.13 Special String Operators and Functions
176(2)
6.4 What You Should Know
178(1)
6.5 What's Next?
179(1)
Exercise 6 Operator, Operator
179(2)
7 If Only, Unconditionally, Forever 181(38)
7.1 Control Structures, Blocks, and Compound Statements
182(6)
7.1.1 Decision Making—Conditional Constructs
183(5)
if and unless Statements
183(1)
The if Construct
183(1)
The if/else Construct
184(1)
The if/elsif/else Construct
185(1)
The unless Construct
186(2)
7.2 Statement Modifiers and Simple Statements
188(2)
7.2.1 The if Modifier
188(1)
7.2.2 The unless Modifier
189(1)
7.3 Repetition with Loops
190(12)
7.3.1 The while Loop
190(2)
7.3.2 The until Loop
192(2)
7.3.3 The do/while and do/until Loops
194(2)
7.3.4 The for Loop (The Three-Part Loop)
196(2)
7.3.5 The foreach (for) Loop
198(4)
7.4 Looping Modifiers
202(15)
7.4.1 The while Modifier
202(1)
7.4.2 The foreach Modifier
203(1)
7.4.3 Loop Control
204(8)
Labels
204(1)
The redo and goto Statements
205(3)
Nested Loops and Labels
208(2)
The continue Statement
210(2)
7.4.4 The switch Statement (given/when)
212(7)
The switch Feature (given/when/say)
214(3)
7.5 What You Should Know
217(1)
7.6 What's Next?
217(1)
Exercise 7 What Are Your Conditions?
218(1)
8 Regular Expressions—Pattern Matching 219(26)
8.1 What Is a Regular Expression?
219(2)
8.1.1 Why Do We Need Regular Expressions?
220(1)
8.2 Modifiers and Simple Statements with Regular Expressions
221(4)
8.2.1 Pattern Binding Operators
222(1)
8.2.2 The DATA Filehandle
223(2)
8.3 Regular Expression Operators
225(18)
8.3.1 The m Operator and Pattern Matching
225(7)
The g Modifier—Global Match
229(1)
The i Modifier—Case Insensitivity
230(1)
Special Scalars for Saving Patterns
230(1)
The x Modifier—The Expressive Modifier
231(1)
8.3.2 The s Operator and Substitution
232(1)
8.3.3 The Pattern Binding Operators with Substitution
232(15)
Changing the Substitution Delimiters
234(1)
Substitution Modifiers
235(5)
Using the Special $& Variable in a Substitution
240(1)
Pattern Matching with a Real File
241(2)
8.4 What You Should Know
243(1)
8.5 What's Next?
243(1)
Exercise 8 A Match Made in Heaven
244(1)
9 Getting Control—Regular Expression Metacharacters 245(52)
9.1 The RegExLib.com Library
245(2)
9.2 Regular Expression Metacharacters
247(43)
9.2.1 Metacharacters for Single Characters
251(7)
The Dot Metacharacter
251(1)
The s Modifier—The Dot Metacharacter and the Newline
252(1)
The Character Class
253(4)
The POSIX Bracket Expressions
257(1)
9.2.2 Whitespace Metacharacters
258(3)
9.2.3 Metacharacters to Repeat Pattern Matches
261(24)
The Greed Factor
261(6)
Metacharacters That Turn off Greediness
267(2)
Anchoring Metacharacters
269(2)
The m Modifier
271(2)
Alternation
273(1)
Grouping or Clustering
273(3)
Remembering or Capturing
276(4)
Turning off Greed
280(1)
Turning off Capturing
281(1)
Metacharacters That Look Ahead and Behind
282(3)
9.2.4 The tr or y Operators
285(5)
The d Delete Option
288(1)
The c Complement Option
289(1)
The s Squeeze Option
290(1)
9.3 Unicode
290(4)
9.3.1 Perl. and Unicode
291(3)
9.4 What You Should Know
294(1)
9.5 What's Next?
295(1)
Exercise 9 And the Search Goes On
295(2)
10 Getting a Handle on Files 297(50)
10.1 The User-Defined Filehandle
297(10)
10.1.1 Opening Files—The open Function
297(1)
10.1.2 Opening for Reading
298(2)
Closing the Filehandle
299(1)
The die Function
299(1)
10.1.3 Reading from a File and Scalar Assignment
300(6)
The Filehandle and $_
300(1)
The Filehandle and a User-Defined Scalar Variable
301(1)
"Slurping" a File into an Array
302(1)
Using map to Create Fields from a File
303(1)
Slurping a File into a String with the read Function
304(2)
10.1.4 Loading a Hash from a File
306(1)
10.2 Reading from STDIN
307(26)
10.2.1 Assigning Input to a Scalar Variable
307(1)
10.2.2 The chop and chomp Functions
308(1)
10.2.3 The read Function
309(1)
10.2.4 The getc Function
310(1)
10.2.5 Assigning Input to an Array
311(1)
10.2.6 Assigning Input to a Hash
312(1)
10.2.7 Opening for Writing
313(2)
10.2.8 Win32 Binary Files
315(1)
10.2.9 Opening for Appending
316(1)
10.2.10 The select Function
317(1)
10.2.11 File Locking with flock
317(2)
10.2.12 The seek and tell Functions
319(5)
The seek Function
319(3)
The tell Function
322(2)
10.2.13 Opening for Reading and Writing
324(2)
10.2.14 Opening for Anonymous Pipes
326(7)
The Output Filter
327(2)
Sending the Output of a Filter to a File
329(1)
Input Filter
330(3)
10.3 Passing Arguments
333(9)
10.3.1 The @ARGV Array
333(1)
10.3.2 ARGV and the Null Filehandle
334(4)
10.3.3 The eof Function
338(2)
10.3.4 The -i Switch—Editing Files in Place
340(2)
10.4 File Testing
342(2)
10.5 What You Should Know
344(1)
10.6 What's Next?
344(1)
Exercise 10 Getting a Handle on Things
345(2)
11 How Do Subroutines Function? 347(30)
11.1 Subroutines/Functions
348(4)
11.1.1 Defining and Calling a Subroutine
349(3)
Forward Declaration
351(1)
Scope of Variables
351(1)
11.2 Passing Arguments and the @_ Array
352(21)
11.2.1 Call-by-Reference and the @_ Array
353(1)
11.2.2 Assigning Values from @_
353(3)
Passing a Hash to a Subroutine
355(1)
11.2.3 Returning a Value
356(1)
11.2.4 Scoping Operators: local, my, our, and state
357(4)
The local Operator
358(1)
The my Operator
358(3)
11.2.5 Using the strict Pragma (my and our)
361(3)
The state Feature
363(1)
11.2.6 Putting It All Together
364(1)
11.2.7 Prototypes
365(1)
11.2.8 Context and Subroutines
366(3)
The wantarray Function and User-Defined Subroutines
367(2)
11.2.9 Autoloading
369(2)
11.2.10 BEGIN and END Blocks (Startup and Finish)
371(1)
11.2.11 The subs Function
371(2)
11.3 What You Should Know
373(1)
11.4 What's Next?
373(1)
Exercise 11 I Can't Seem to Function Without Subroutines
374(3)
12 Does This Job Require a Reference? 377(30)
12.1 What Is a Reference?
377(27)
12.1.1 Hard References
378(4)
The Backslash Operator
379(1)
Dereferencing the Pointer
379(3)
12.1.2 References and Anonymous Variables
382(1)
Anonymous Arrays
382(1)
Anonymous Hashes
383(1)
12.1.3 Nested Data Structures
383(8)
Using Data::Dumper
384(1)
Array of Lists
385(2)
Array of Hashes
387(2)
Hash of Hashes
389(2)
12.1.4 More Nested Structures
391(2)
12.1.5 References and Subroutines
393(3)
Anonymous Subroutines
393(1)
Subroutines and Passing by Reference
394(2)
12.1.6 The ref Function
396(2)
12.1.7 Symbolic References
398(2)
The strict Pragma
400(1)
12.1.8 Typeglobs (Aliases)
400(7)
Filehandle References and Typeglobs
402(2)
12.2 What You Should Know
404(1)
12.3 What's Next?
404(1)
Exercise 12 It's Not Polite to Point!
405(2)
13 Modularize It, Package It, and Send It to the Library! 407(40)
13.1 Before Getting Started
407(10)
13.1.1 An Analogy
408(1)
13.1.2 What Is a Package?
408(3)
Referencing Package Variables and Subroutines from Another Package
409(2)
13.1.3 What Is a Module?
411(1)
13.1.4 The Symbol Table
412(5)
13.2 The Standard Perl Library
417(19)
13.2.1 The @INC Array
418(2)
Setting the PERL5LIB Environment Variable
419(1)
The lib Pragma
420(1)
13.2.2 Packages and .pm Files
420(4)
The require Function
421(1)
The use Function (Modules and Pragmas)
421(1)
Using Perl to Include Your Own Library
422(2)
13.2.3 Exporting and Importing
424(3)
The Exporter.pm Module
424(3)
13.2.4 Finding Modules and Documentation from the Standard Perl Library
427(4)
Viewing the Contents of the Carp.pm Module
428(3)
13.2.5 How to "Use" a Module from the Standard Perl Library
431(1)
13.2.6 Using Perl to Create Your Own Module
432(4)
Creating an Import Method Without Exporter
435(1)
13.3 Modules from CPAN
436(5)
13.3.1 The CPAN.pm Module
437(2)
Retrieving a Module from CPAN with the cpan Shell
438(1)
13.3.2 Using Perl Program Manager
439(2)
13.4 Using Perlbrew and CPAN Minus
441(3)
13.5 What You Should Know
444(1)
13.6 What's Next?
445(1)
Exercise 13 I Hid All My Perls in a Package
445(2)
14 Bless Those Things! (Object-Oriented Perl) 447(72)
14.1 The OOP Paradigm
447(3)
14.1.1 What Are Objects?
447(1)
14.1.2 What Is a Class?
448(1)
14.1.3 Some Object-Oriented Lingo
449(1)
14.2 Perl Classes, Objects, and Methods—Relating to the Real World
450(28)
14.2.1 The Steps
451(1)
14.2.2 A Complete Object-Oriented Perl Program
451(3)
A Perl Package Is a Class
453(1)
A Perl Class
453(1)
14.2.3 Perl Objects
454(2)
References
454(1)
The Blessing
454(2)
14.2.4 Methods Are Perl Subroutines
456(8)
Definition
456(1)
Types of Methods
457(1)
Invoking Methods
457(1)
Creating the Object with a Constructor
458(2)
Creating the Instance Methods
460(2)
Invoking the Methods (User Interaction)
462(2)
14.2.5 Creating an Object-Oriented Module
464(8)
Passing Arguments to Methods
466(1)
Passing Parameters to Instance Methods
467(3)
Named Parameters and Data Checking
470(2)
14.2.6 Polymorphism and Runtime Binding
472(4)
14.2.7 Destructors and Garbage Collection
476(2)
14.3 Anonymous Subroutines, Closures, and Privacy
478(6)
14.3.1 What Is a Closure?
478(3)
14.3.2 Closures and Objects
481(3)
14.4 Inheritance
484(17)
14.4.1 The @ISA Array and Calling Methods
484(2)
14.4.2 $AUTOLOAD, sub AUTOLOAD, and UNIVERSAL
486(3)
14.4.3 Derived Classes
489(7)
14.4.4 Multiple Inheritance and Roles with Moose
496(3)
14.4.5 Overriding a Parent Method and the SUPER Pseudo Class
499(2)
14.5 Plain Old Documentation—Documenting a Module
501(7)
14.5.1 pod Files
502(2)
14.5.2 pod Commands
504(2)
Checking Your pod Commands
504(2)
14.5.3 How to Use the pod Interpreters
506(1)
14.5.4 Translating pod Documentation into Text
506(1)
14.5.5 Translating pod Documentation into HTML
507(1)
14.6 Using Objects from the Perl Library
508(4)
14.6.1 An Object-Oriented Module from the Standard Pee Library
509(2)
14.6.2 Using a Module with Objects from the Standard Perl Library
511(1)
14.7 What You Should Know
512(1)
14.8 What's Next?
513(1)
Exercise 14 What's the Object of This Lesson?
513(6)
15 Pert Connects with MySQL 519(76)
15.1 Introduction
519(1)
15.2 What Is a Relational Database?
520(10)
15.2.1 Client/Server Databases
521(1)
15.2.2 Components of a Relational Database
522(6)
The Database Server
523(1)
The Database
523(1)
Tables
523(1)
Records and Fields
524(3)
The Database Schema
527(1)
15.2.3 Talking to the Database with SQL
528(2)
English-like Grammar
528(1)
Semicolons Terminate SQL Statements
529(1)
Naming Conventions
529(1)
Reserved Words
529(1)
Case Sensitivity
529(1)
The Result Set
530(1)
15.3 Getting Started with MySQL
530(26)
15.3.1 Installing MySQL
531(1)
15.3.2 Connecting to MySQL
532(2)
Editing Keys at the MySQL Console
533(1)
Setting a Password
533(1)
15.3.3 Graphical User Tools
534(3)
The MySQL Query Browser
534(2)
The MySQL Privilege System
536(1)
15.3.4 Finding the Databases
537(2)
Creating and Dropping a Database
538(1)
15.3.5 Getting Started with Basic Commands
539(17)
Creating a Database with MySQL
539(2)
Selecting a Database with MySQL
541(1)
Creating a Table in the Database
541(1)
Data Types
541(2)
Adding Another Table with a Primary Key
543(1)
Inserting Data into Tables
544(2)
Selecting Data from Tables—The SELECT Command
546(1)
Selecting by Columns
546(1)
Selecting All Columns
547(1)
The WHERE Clause
548(2)
Sorting Tables
550(1)
Joining Tables
551(1)
Deleting Rows
552(1)
Updating Data in a Table
553(1)
Altering a Table
554(1)
Dropping a Table
555(1)
Dropping a Database
555(1)
15.4 What Is the Perl DBI?
556(23)
15.4.1 Installing the DBD Driver
556(2)
Without the DBD-MySQL with PPM
556(2)
Using PPM with Linux
558(1)
Installing the DBD::mysql Driver from CPAN
558(1)
15.4.2 The DBI Class Methods
558(2)
15.4.3 How to Use DBI
560(1)
15.4.4 Connecting to and Disconnecting from the Database
561(2)
The connect() Method
561(2)
The disconnect() Method
563(1)
15.4.5 Preparing a Statement Handle and Fetching Results
563(4)
Select, Execute, and Dump the Results
563(1)
Select, Execute, and Fetch a Row As an Array
564(2)
Select, Execute, and Fetch a Row As a Hash
566(1)
15.4.6 Getting Error Messages
567(4)
Automatic Error Handling
567(1)
Manual Error Handling
567(2)
Binding Columns and Fetching Values
569(2)
15.4.7 The ? Placeholder and Parameter Binding
571(5)
Binding Parameters in the execute Statement
571(3)
Binding Parameters and the bind_param() Method
574(2)
15.4.8 Handling Quotes
576(1)
15.4.9 Cached Queries
577(2)
15.5 Statements That Don't Return Anything
579(4)
15.5.1 The do() Method
579(4)
Adding Entries
579(1)
Deleting Entries
580(1)
Updating Entries
581(2)
15.6 Transactions
583(7)
15.6.1 Commit and Rollback
583(2)
15.6.2 Perl DBI, the Web, and the Dancer Framework
585(5)
15.7 What's Left?
590(1)
15.8 What You Should Know
591(1)
15.9 What's Next?
591(1)
Exercise 15 Practicing Queries and Using DBI
592(3)
16 Interfacing with the System 595(80)
16.1 System Calls
595(34)
16.1.1 Directories and Files
597(2)
Backslash Issues
597(1)
The File::Spec Module
598(1)
16.1.2 Directory and File Attributes
599(4)
UNIX
599(1)
Windows
600(3)
16.1.3 Finding Directories and Files
603(2)
16.1.4 Creating a Directory—The mkdir Function
605(2)
UNIX
605(1)
Windows
605(2)
16.1.5 Removing a Directory—The rmdir Function
607(1)
16.1.6 Changing Directories—The chdir Function
607(1)
16.1.7 Accessing a Directory via the Directory Filehandle
608(4)
The opendir Function
609(1)
The readdir Function
609(1)
The closedir Function
610(1)
The telldir Function
611(1)
The rewinddir Function
611(1)
The seekdir Function
611(1)
16.1.8 Permissions and Ownership
612(4)
UNIX
612(1)
Windows
612(2)
The chmod Function (UNIX)
614(1)
The chmod Function (Windows)
614(1)
The chown Function (UNIX)
615(1)
The umask Function (UNIX)
616(1)
16.1.9 Hard and Soft Links
616(4)
UNIX
616(1)
Windows
617(1)
The link and unlink Functions (UNIX)
618(1)
The symlink and readlink Functions (UNIX)
619(1)
16.1.10 Renaming Files
620(1)
The rename Function (UNIX and Windows)
620(1)
16.1.11 Changing Access and Modification Times
620(1)
The utime Function
620(1)
16.1.12 File Statistics
621(3)
The stat and lstat Functions
621(3)
16.1.13 Packing and Unpacking Data
624(5)
16.2 Processes
629(29)
16.2.1 UNIX Processes
629(2)
16.2.2 Win32 Processes
631(1)
16.2.3 The Environment (UNIX and Windows)
632(2)
16.2.4 Processes and Filehandles
634(3)
Login Information—The getlogin Function
635(1)
Special Process Variables (pid, uid, euid, gid, egid)
635(1)
The Parent Process ID—The getppid Function and the $$ Variable
635(1)
The Process Group ID—The pgrp Function
636(1)
16.2.5 Process Priorities and Niceness
637(1)
The getpriority Function
637(1)
The setpriority Function (nice)
637(1)
16.2.6 Password Information
638(5)
UNIX
638(1)
Windows
639(2)
Getting a Password Entry (UNIX)—The getpwent Function
641(1)
Getting a Password Entry by Username—The getpwnam Function
642(1)
Getting a Password Entry by uid—The getpwuid Function
643(1)
16.2.7 Time and Processes
643(6)
The Time::Piece Module
644(1)
The times Function
645(1)
The time Function (UNIX and Windows)
646(1)
The gmtime Function
646(2)
The localtime Function
648(1)
16.2.8 Process Creation UNIX
649(5)
The fork Function
649(3)
The exec Funtion
652(1)
The wait and waitpid Functions
653(1)
The exit Function
654(1)
16.2.9 Process Creation Win32
654(4)
The start Command
654(1)
The Win32::Spawn Function
655(1)
The Win32::Process Module
656(2)
16.3 Other Ways to Interface with the Operating System
658(6)
16.3.1 The syscall Function and the h2ph Script
658(1)
16.3.2 Command Substitution—The Backquotes
659(1)
16.3.3 The Shell.pm Module
660(1)
16.3.4 The system Function
661(2)
16.3.5 Globbing (Filename Expansion and Wildcards)
663(1)
16.4 Error Handling
664(5)
16.4.1 The Carp Module
665(1)
The die Function
665(1)
The warn Function
666(1)
16.4.2 The eval Function
666(3)
16.5 Signals and the %SIG Hash
669(4)
16.5.1 Catching Signals
669(1)
16.5.2 Sending Signals to Processes
670(2)
The kill Function
670(1)
The alarm Function
671(1)
The sleep Function
672(1)
16.5.3 Attention, Windows Users!
672(1)
16.6 What You Should Know
673(1)
Exercise 16 Interfacing with the System
674(1)
A Perl Built-ins, Pragmas, Modules, and the Debugger 675(48)
A.1 Perl Functions
675(30)
A.2 Special Variables
705(3)
A.3 Perl Pragmas
708(2)
A.4 Perl Modules
710(6)
A.5 Command-Line Switches
716(2)
A.6 Debugger
718(5)
A.6.1 Getting Information About the Debugger
718(1)
A.6.2 The Perl Debugger
718(1)
A.6.3 Entering and Exiting the Debugger
719(1)
A.6.4 Debugger Commands
720(3)
B SQL Language Tutorial 723(52)
B.1 What Is SQL?
723(8)
B.1.1 Standarizing SQL
724(1)
B.1.2 Executing SQL Statements
724(1)
The MySQL Query Browser
725(1)
B.1.3 About SQL Commands/Queries
725(3)
English-like Grammar
725(1)
Semicolons Terminate SQL Statements
726(1)
Naming Conventions
727(1)
Reserved Words
727(1)
Case Senstivity
727(1)
The Result Set
728(1)
B.1.4 SQL and the Database
728(1)
The show databases Command
728(1)
The USE Command
729(1)
B.1.5 SQL Database Tables
729(2)
The SHOW and DESCRIBE Commands
730(1)
B.2 SQL Data Manipulation Language (DML)
731(17)
B.2.1 The SELECT Command
731(14)
Select Specified Columns
732(1)
Select All Columns
732(1)
The SELECT DISTINCT Statement
733(1)
Limiting the Number of Lines in the Result Set with LIMIT
734(2)
The WHERE Clause
736(1)
Using Quotes
737(1)
Using the = and <> Operators
737(1)
What Is NULL?
737(2)
The > and < Operators
739(1)
The AND and OR Operators
740(1)
The LIKE and NOT LIKE Conditions
741(1)
Pattern Matching and the % Wildcard
741(2)
TheWildcard
743(1)
The Statement
743(1)
Sorting Results with ORDER BY
744(1)
B.2.2 The INSERT Command
745(1)
B.2.3 The UPDATE Command
746(1)
B.2.4 The DELETE Statement
747(1)
B.3 SQL Data Definition Language
748(13)
B.3.1 Creating the Database
748(1)
B.3.2 SQL Data Types
749(2)
B.3.3 Creating a Table
751(2)
B.3.4 Creating a Key
753(3)
Primary Keys
753(2)
Foreign Keys
755(1)
B.3.5 Relations
756(3)
Two Tables with a Common Key
756(1)
Using a Fully Qualified Name and a Dot to Join the Tables
757(1)
Aliases
758(1)
B.3.6 Altering a Table
759(2)
B.3.7 Dropping a Table
761(1)
B.3.8 Dropping a Database
761(1)
B.4 SQL Functions
761(9)
B.4.1 Numeric Functions
762(3)
Using GROUP BY
763(2)
B.4.2 String Functions
765(1)
B.4.3 Date and Time Functions
766(10)
Formatting the Date and Time
767(2)
The MySQL EXTRACT Command
769(1)
B.5 Appendix Summary
770(1)
B.6 What You Should Know
770(1)
Exercise B Do You Speak My Language?
771(4)
C Introduction to Moose (A Postmodern Object System for Perl 5) 775(22)
C.1 Getting Started
775(1)
C.2 The Constructor
776(1)
C.3 The Attributes
776(19)
C.3.1 The has Function
777(1)
C.3.2 Before and After Moose Examples
778(3)
C.3.3 Moose Types
781(4)
C.3.4 Example Using Moose and Extensions
785(6)
C.3.5 Example Using Inheritance with Moose
791(4)
C.4 What About Moo?
795(1)
C.5 Appendix Summary
796(1)
C.6 References
796(1)
D Perlbrew, CPAN, and cpanm 797(10)
D.1 CPAN and @INC
797(5)
D.1.1 Finding Modules
798(1)
D.1.2 Using Modules
798(2)
I Already Have It!
799(1)
D.1.3 Package Manager
800(1)
D.1.4 Manually: CPAN
801(7)
local::lib
801(1)
D.2 cpanm
802(1)
D.3 Perlbrew
803(2)
D.4 Caveats: C Dependencies
805(1)
D.5 Windows
806(1)
E Dancing with Perl 807(24)
E.1 A New Dancer App
808(21)
E.1.1 Verbs
811(3)
E.1.2 Templating
814(4)
E.1.3 Parameters
818(8)
E.1.4 POST
826(3)
Exercise E May I Have This Dance?
829(2)
Index 831
Ellie Quigley has taught scripting in Silicon Valley for more than twenty-five years. Her Perl and shell programming classes at the University of California, Santa Cruz Extension are part of Silicon Valley lore. Her other best-selling Prentice Hall books include UNIX® Shells by Example, Fourth Edition; PHP and MySQL by Example (with Marko Gargenta); and JavaScript by Example. A major player in developing UCSCs Silicon Valley Extension program, she has created and customized courses for pioneering firms, including Xilinx, NetApp, Yahoo, and Juniper.