当前位置:首页 > 工业技术
精通Perl  第2版
精通Perl  第2版

精通Perl 第2版PDF电子书下载

工业技术

  • 电子书积分:13 积分如何计算积分?
  • 作 者:(美)福瓦著
  • 出 版 社:南京:东南大学出版社
  • 出版年份:2014
  • ISBN:9787564150020
  • 页数:377 页
图书介绍:你需要朝Perl迈出下一步,精通可以让编码更简单、维护更方便、执行更快速的高级概念。《精通Perl》并不是一些奇妙诀窍的集合,而是一种针对Perl编程的思考方法,适用于解决调试、配置和很多作为一名编程工作者会遇到的日常问题。本书是O’Reilly出版社标志性的Perl教程系列中的第三本(前面两本是《Learning Perl》和《Intermediate Perl》),本次完全修订版把所有内容都整合在一起,帮助你随心所欲地掌握Perl。
《精通Perl 第2版》目录
标签:精通

1.Advanced Regular Expressions 1

Readable Regexes,/x and(?#…) 1

Global Matching 3

Global Match Anchors 5

Recursive Regular Expressions 7

Repeating a Subpattern 7

Lookarounds 18

Lookahead Assertions,(?=PATTERN)and(?!PATTERN) 18

Lookbehind Assertions,(?<!PATTERN)and(?<=PATTERN) 22

Debugging Regular Expressions 25

The-D Switch 25

Summary 29

Further Reading 29

2.Secure Programming Techniques 31

Bad Data Can Ruin Your Day 31

Taint Checking 32

Warnings Instead of Fatal Errors 34

Automatic Taint Mode 35

mod_perl 35

Tainted Data 35

Side Effects of Taint Checking 36

Untainting Data 37

IO::Handle::untaint 39

Hash Keys 40

Taint::Util 41

Choosing Untainted Data with Tainted Data 41

Symbolic References 42

Defensive Database Programming with DBI 45

List Forms of system and exec 47

Three-Argument open 48

sysopen 49

Limit Special Privileges 49

Safe Compartments 50

Safe Limitations 56

A Little Fun 56

Summary 57

Further Reading 58

3.Perl Debuggers 61

Before You Waste Too Much Time 61

The Best Debugger in the World 62

Safely Changing Modules 63

Wrapping Subroutines 64

The Perl Debugger 67

Alternative Debuggers 68

Using a Different Debugger with-d 68

Devel::ptkdb 68

Devel::ebug 70

Devel::hdb 71

IDE Debuggers 72

EPIC 72

Komodo 72

Summary 72

Further Reading 73

4.Profiling Perl 75

Finding the Culprit 75

The General Approach 79

Profiling DBI 81

Other DBI::Profile Reports 85

Making It Even Easier 86

Switching Databases 87

Devel::NYTProf 89

Writing My Own Profiler 90

Devel::Line Counter 90

Profiling Test Suites 91

Devel::Cover 91

Summary 93

Further Reading 93

5.Benchmarking Perl 95

Benchmarking Theory 95

Benchmarking Time 97

Comparing Code 100

Don't Turn Off Your Thinking Cap 103

Isolating the Environment 107

Handling Outliers 109

Memory Use 111

The perlbench Tool 116

Summary 118

Further Reading 118

6.Cleaning Up Perl 121

Good Style 121

perltidy 122

Deobfuscation 124

De-encoding Hidden Source 124

Unparsing Code with B::Deparse 127

Perl::Critic 129

Creating My Own Perl::Critic Policy 132

Summary 133

Further Reading 134

7.Symbol Tables and Typeglobs 135

Package and Lexical Variables 135

Getting the Package Version 137

The Symbol Table 139

Typeglobs 141

Aliasing 144

Filehandle Arguments in Older Code 146

Naming Anonymous Subroutines 147

The Easy Way 148

Summary 149

Further Reading 150

8.Dynamic Subroutines 151

Subroutines as Data 151

Creating and Replacing Named Subroutines 155

Symbolic References 157

Iterating Through Subroutine Lists 159

Processing Pipelines 161

Self-Referencing Anonymous Subroutines 162

Method Lists 162

Subroutines as Arguments 163

Autoloaded Methods 167

Hashes as Objects 169

AutoSplit 170

Summary 171

Further Reading 171

9.Modifying and Jury-Rigging Modules 173

Choosing the Right Solution 173

Sending Patches to the Author 173

Local Patches 175

Taking Over a Module 175

Forking 176

Starting Over on My Own 176

Replacing Module Parts 176

Subclassing 179

An ExtUtils::MakeMaker Example 181

Other Examples 184

Wrapping Subroutines 184

Summary 186

Further Reading 186

10.Configuring Perl Programs 187

Things Not to Do 187

Code in a Separate File 189

Better Ways 190

Environment Variables 190

Special Environment Variables 191

Turning on Extra Output 191

Command-Line Switches 193

The-s Switch 194

Getopt Modules 195

Configuration Files 200

ConfigReader::Simple 200

Config::IniFiles 201

Config::Scoped 201

Other Configuration Formats 202

Scripts with a Different Name 202

Interactive and Noninteractive Programs 203

perl's Config 204

Different Operating Systems 205

Summary 206

Further Reading 206

11.Detecting and Reporting Errors 207

Perl Error Basics 207

Operating System Errors 208

Child Process Errors 210

Errors Specific to the Operating System 212

Reporting Module Errors 213

Separation of Concerns 213

Exceptions 215

eval 216

Multiple Levels of die 217

die with a Reference 218

Propagating Objects with die 220

Clobbering$@ 222

autodie 224

Reporting the Culprit 225

Catching Exceptions 229

Try::Tiny 229

TryCatch 231

Polymorphic Return Values 232

Summary 233

Further Reading 233

12.Logging 235

Recording Errors and Other Information 235

Log4perl 236

Subroutine Arguments 238

Configuring Log4perl 239

Persistent Configuration 243

Logging Categories 243

Other Log::Log4perl Features 245

Summary 247

Further Reading 247

13.Data Persistence 249

Perl-Specific Formats 249

pack 249

Fixed-Length Records 251

Unpacking Binary Formats 251

Data::Dumper 252

Similar Modules 256

Storable 258

Freezing Data 259

Storable's Security Problem 262

Sereal 264

DBM Files 269

dbmopen 270

DBM::Deep 270

Perl-Agnostic Formats 272

JSON 272

YAML 274

MessagePack 276

Summary 277

Further Reading 277

14.Working with Pod 279

The Pod Format 279

Directives 279

Encoding 281

Body Elements 281

Translating Pod 281

Pod Translators 282

Pod::Perldoc::ToToc 283

Pod::Simple 285

Subclassing Pod::Simple 288

Pod in Your Web Server 288

Testing Pod 288

Checking Pod 289

Pod Coverage 289

Hiding and Ignoring Functions 291

Summary 292

Further Reading 292

15.Working with Bits 293

Binary Numbers 293

Writing in Binary 294

Bit Operators 295

Unary NOT(~) 296

Bitwise AND (&) 298

Binary OR(|) 299

Exclusive OR(^) 300

Left<<and Right>>Shift Operators 302

Bit Vectors 302

The vec Function 304

Bit String Storage 306

Storing DNA 308

Checking Primes 309

Keeping Track of Things 311

Summary 312

Further Reading 312

16.The Magic of Tied Variables 313

They Look Like Normal Variables 313

At the User Level 314

Behind the Curtain 315

Scalars 316

Tie::Cycle 316

Bounded Integers 319

Self-Destructing Values 320

Arrays 321

Reinventing Arrays 322

Something a Bit More Realistic 325

Hashes 330

Filehandles 333

Summary 335

Further Reading 335

17.Modules as Programs 337

The main Thing 337

Backing Up 338

Who's Calling? 339

Testing the Program 340

Modules as Tests 340

Creating a Program Distribution 345

Adding to the Script 347

Distributing the Programs 352

Summary 352

Further Reading 353

A.Further Reading 355

B.brian's Guide to Solving Any Perl Problem 359

Index of Perl Modules in This Book 366

Index 369

相关图书
作者其它书籍
返回顶部