- Signerad!
Beginning Perl
304 kr
Beställningsvara. Skickas inom 5-8 vardagar. Fri frakt över 249 kr.
Beskrivning
Produktinformation
- Utgivningsdatum:2012-09-14
- Mått:188 x 236 x 36 mm
- Vikt:1 238 g
- Format:Häftad
- Språk:Engelska
- Antal sidor:752
- Förlag:John Wiley & Sons Inc
- ISBN:9781118013847
Utforska kategorier
Mer om författaren
Curtis "Ovid" Poe has specialized in Perl since 2000. He is an author, a regular guest speaker at conferences across Europe and the United States, and he wrote the test harness that currently ships with the Perl language. "This is not your everyday Beginning Perl book. Not only does Ovid provide splendid coverage of Perl's basics and best practices, he also covers modern Perl techniques and modules, where Perl's real power lies. [It] is like being given Batman's utility belt: you have everything you need to do truly amazing things. If Perl were a shark, this book would teach you how to outfit it with lasers." Paul Fenwick, Perl Training Australia Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
Innehållsförteckning
- Introduction xxiiiChapter 1: What is Perl? 1Perl Today 2Getting Perl 3Working with Non-Windows Platforms: perlbrew 4Using Windows 6The Perl Community 8IRC 8PerlMonks 9Perl Mongers 9StackOverflow 9Using perldoc 11Understanding the Structure of perldoc 11Getting Started with perldoc 11Using Tutorials and FAQs 12Using the perldoc -f function 14Using a Terminal Window 14Using the Command Line 15Creating a Work Directory 16Creating Hello, World! 18Writing Your First Program 18Shebang Lines 21Summary 22Chapter 2: Understanding the CPAN 25CPAN and METACPAN 26Finding and Evaluating Modules 27Downloading and Installing 29CPAN Clients 33Using the CPAN.pm Client 33Using the Cpanm Client 35PPM 36CPAN::Mini 36Summary 39Chapter 3: Variables 41What is Programming? 42A Few Things to Note Before Getting Started 43strict, warnings, and diagnostics 43The my Function 43Sigils 44Identifiers 45Scalars 46Strings 47Numbers 51Arrays 53Breaking Down the Code 54Accessing Elements 55Iterating over Arrays 58Hashes 58Accessing Elements 59Iterating Over Hashes 60Adding Data to Hashes 60Slices 61Array Slices 62Hash Slices 62Context 63Scalar Context 63List Context 64Scope 67my Variables 67Package Variables 69Strict, Warnings, and Diagnostics 72strict 74warnings 74diagnostics 75Working Without a Net 76Perl’s Built-in Variables 78$_ 78%ENV 79@ARGV 79Other Special Variables 80Summary 81Chapter 4: Working With Data 83Using Scalars 84Working with Strings 85Using String Operators 94Scalar::Util 97Numeric Builtins 98Bitwise Operators 103Understanding Booleans 103Assignment Operators 108Precedence and Associativity 109Array and List Functions 111Built-in Array Functions 111List::Util 116Built-in Hash Functions 116delete() 116exists() 117keys() 117values() 117each() 117Scoping Keywords 119my() 119local() 119our() 120state() 120Summary 121Chapter 5: Control Flow 125Using the if Statement 126Understanding Basic Conditionals 126else/elsif/unless 128The Ternary Operator ?: 131for/foreach loops 132Arrays 132Lists 135C-Style 136Using while/until Loops 142Lists 143last/next/redo/continue 144Labels 146Statement Modifiers 147Types of Statement Modifiers 147do while/do until 149given/when 151Basic Syntax 151The Switch Module 153Summary 154Chapter 6: References 157References 101 158Array References 158Hash References 159Anonymous References 160Other References 163Working with References 166Debugging 166Copying 169Slices 172Summary 173Chapter 7: Subroutines 175Subroutine Syntax 176Argument Handling 177Multiple Arguments 178Named Arguments 179Aliasing 181State Variables (Pre- and Post-5.10) 181Passing a List, Hash, or Hashref? 184Returning Data 186Returning True/False 186Returning Single and Multiple Values 188wantarray 189FAIL! 190“Wake Up! Time to Die!” 191carp and croak 192eval 192evalGotchas 194Try::Tiny 195Subroutine References 196Existing Subroutines 196Anonymous Subroutines 197Closures 197Prototypes 200Argument Coercion 200More Prototype Tricks 202Mimicking Builtins 204Forward Declarations 206Prototype Summary 207Recursion 209Basic Recursion 209Divide and Conquer 210Memoization 211Things to Watch For 215Argument Aliasing 215Scope Issues 216Doing Too Much 216Too Many Arguments 217Summary 217Chapter 8: Regular Expressions 219Basic Matching 220Quantifiers 221Escape Sequences 223Extracting Data 226Modifiers and Anchors 228Character Classes 231Grouping 232Advanced Matching 235Substitutions 235Lookahead/Lookbehind Anchors 236Named Subexpressions (5.10) 238Common Regular Expression Issues 241Regexp::Common 241E-mail Addresses 242HTML 242Composing Regular Expressions 243Summary 245Chapter 9: Files and Directories 249Basic File Handling 250Opening and Reading a File 250File Test Operators 258The Diamond Operator 260Temporary Files 260DATA as a File 261binmode 262Directories 265Reading Directories 265Globbing 265Unicode 266What is Unicode? 267Two Simple Rules 267Lots of Complicated Rules 271Useful Modules 276File::Find 276File::Path 278File::Find::Rule 279Summary 284Chapter 10: Sort, Map, and Grep 287Basic Sorting 288Sorting Alphabetically 288Sorting Numerically 289Reverse Sorting 290Complex Sort Conditions 290Writing a sort Subroutine 292Sorting and Unicode Fun! 293map and grep 297Using grep 298Using map 303Aliasing Issues 305Trying to Do Too Much 306Trying to Be Clever 307Putting It All Together 308Schwartzian Transform (aka decorate, sort, undecorate) 308Guttman-Rosler Transform 310Summary 311Chapter 11: Packages and Modules 315Namespaces and Packages 316use Versus require 321Package Variables 323Version Numbers 326Subroutines in Other Packages 327Exporting 327Naming Conventions 330BEGIN, UNITCHECK, CHECK, INIT, and END 335BEGIN blocks 336END Blocks 337INIT, CHECK, and UNITCHECK Blocks 337Plain Old Documentation (POD) 338Documentation Structure 340Headings 340Paragraphs 341Lists 341Verbatim 342Miscellaneous 342Creating and Installing Modules 344Creating a Simple Module 344Makefi le.PL or Module::Build? 349Summary 349Chapter 12: Object Oriented Perl 353What are Objects? The Ævar the Personal Shopper 354Three Rules of Perl OO 355Class is a Package 355An Object is a Reference That Knows Its Class 356A Method is a Subroutine 358Objects – Another View 371Using TV::Episode 371Subclassing 374Using TV::Episode::Broadcast 375Class Versus Instance Data 379A Brief Recap 381Overloading Objects 381Using UNIVERSAL 385Understanding Private Methods 387Gotchas 393Unnecessary Methods 393“Reaching Inside” 394Multiple Inheritance 394Summary 397Chapter 13: Moose 399Understanding Basic Moose Syntax 400Using Attributes 402Using Constructors 405Understanding Inheritance 408Taking Care of Your Moose 409Advanced Moose Syntax 413Using Type Constraints 414Using Method Modifiers 417Understanding and Using Roles 420Exploring MooseX 425Rewriting Television::Episode 428Moose Best Practices 433Use namespace::autoclean and Make Your Class Immutable 434Never Override new() 434Always Call Your Parent BUILDARGS Method 434Provide Defaults if an Attribute is Not Required 434Default to Read-Only 434Put Your Custom Types in One Module andGive Them a Namespace 435Don’t Use Multiple Inheritance 435Always Consume All Your Roles at Once 435Summary 436Chapter 14: Testing 439Basic Tests 440Using Test::More 440Writing Your Tests 442Understanding the prove Utility 443Understanding Test::More Test Functions 444Using ok 445Using is 445Using like 448Using is_deeply 449Using SKIP 450Using TODO 450Using eval {} 451Using use_ok and require_ok 452Working with Miscellaneous Test Functions 453Using Other Testing Modules 457Using Test::Diff erences 457Using Test::Exception 459Using Test::Warn 460Using Test::Most 460Understanding xUnit Style Using Testing 461Using Test::Class 461A Basic Test Class 463Extending a Test Class 467Using Test Control Methods 471Calling Parent Test Control Methods 473Summary 477Chapter 15: The Interwebs 481A Brief Introduction to HTTP 482Plack 484Hello, World! 484Handling Parameters 490Templates 492Handling POST Requests 496Sessions 500Web Clients 511Extracting Links from Web Pages 512Extracting Comments from Web Pages 514Filling Out Forms Programmatically 515Summary 520Chapter 16: Databases 523Using the DBI 524Connecting to a Database 524Using SQLite 527Using DBD::SQLite 527Selecting Basic Data 533Using SELECT Statements 533Using Bind Parameters 536Inserting and Updating Data 539Creating Transactions 540Handling Errors 541Summary 542Chapter 17: Plays Well with Others 545The Command Line 546Reading User Input 546Handling Command-Line Arguments 548perlrun 551Other Programs 556Running an External Program 556Reading Another Program’s Output 559Writing to Another Program’s Input 560STDERR 562Summary 565Chapter 18: Common Tasks 567Using CSV Data 568Reading CSV Data 569Writing CSV Data 570Understanding Basic XML 571Reading CSV Data 572Writing CSV Data 576Handling Dates 580Using the DateTime Module 580Using Date::Tiny and DateTime::Tiny 581Understanding Your Program 587Using the Debugger 587Profi ling 594Perl::Critic 604Summary 608Chapter 19: The Next Steps 611What Next? 612What This Book Covers 612What This Book Leaves Out 613Understanding Object-Relational Mappers 613Understanding DBIx::Class 614Understanding Basic DBIx::Class Usage 614Understanding the Pros and Cons of an ORM 618Using DBIx::Class::Schema::Loader 624Using the Template Toolkit 625Why Use Templates? 625An Introduction to Template Toolkit 626Using Catalyst to Build Apps 634The Beauty of MVC 635Setting Up a Catalyst Application 635Using Catalyst Views 641Using Catalyst Models 643Using Catalyst Controllers 646CRUD: Create, Read, Update, and Delete 648Summary 651Appendix: Answers to Exercises 655Index 695
Du kanske också är intresserad av
- -22%
- 4 för 3
Brevbäraren i Lizzanello
Francesca Giannone
Pocket, 2026
99 kr
- -30%
- Nyhet
- 4 för 3
- 4 för 3
- 4 för 3
En flicka som kallas Alice
Kristin Hannah
Pocket, 2025
99 kr
- 4 för 3
- 4 för 3