Description
Efnisyfirlit
- Beginning Perl
- Copyright
- Credits
- About the Author
- About the Technical Editor
- Acknowledgments
- Contents
- Introduction
- Who this Book is for
- If You Have No Programming Experience
- If You’re An Experienced Programmer
- What this Book Covers
- How this Book is Structured
- What You Need to Use this Book
- Conventions
- Source Code
- Errata
- P2P.Wrox.Com
- Chapter 1: What is Perl?
- Perl Today
- Getting Perl
- Working with Non-Windows Platforms: perlbrew
- Using Windows
- The Perl Community
- IRC
- PerlMonks
- Perl Mongers
- StackOverflow
- Using perldoc
- Understanding the Structure of perldoc
- Getting Started with perldoc
- Using Tutorials and FAQs
- Using the perldoc – f function
- Using a Terminal Window
- Using the Command Line
- Creating a Work Directory
- Creating Hello, World!
- Writing Your First Program
- Shebang Lines
- Summary
- Chapter 2: Understanding the CPAN
- CPAN and METACPAN
- Finding and Evaluating Modules
- Downloading and Installing
- CPAN Clients
- Using the CPAN.pm Client
- Using the Cpanm Client
- PPM
- CPAN::Mini
- Summary
- Chapter 3: Variables
- What Is Programming?
- A Few Things to Note Before Getting Started
- strict, warnings, and diagnostics
- The my Function
- Sigils
- Identifiers
- Scalars
- Strings
- Numbers
- Arrays
- Breaking Down the Code
- Accessing Elements
- Iterating over Arrays
- Hashes
- Accessing Elements
- Iterating Over Hashes
- Adding Data to Hashes
- Slices
- Array Slices
- Hash Slices
- Context
- Scalar Context
- List Context
- Scope
- my Variables
- Package Variables
- Strict, Warnings, and Diagnostics
- strict
- warnings
- diagnostics
- Working Without a Net
- Perl’s Built-in Variables
- $_
- %ENV
- @ARGV
- Other Special Variables
- Summary
- Chapter 4: Working with Data
- Using Scalars
- Working with Strings
- Using String Operators
- Scalar::Util
- Numeric Builtins
- Bitwise Operators
- Understanding Booleans
- Assignment Operators
- Precedence and Associativity
- Array and List Functions
- Built-in Array Functions
- List::Util
- Built-in Hash Functions
- delete()
- exists()
- keys()
- values()
- each()
- Scoping Keywords
- my()
- local()
- our()
- state()
- Summary
- Chapter 5: Control Flow
- Using the if Statement
- Understanding Basic Conditionals
- else/elsif/unless
- The Ternary Operator ?:
- for/foreach loops
- Arrays
- Lists
- C-Style
- Using while/until Loops
- Lists
- last/next/redo/continue
- Labels
- Statement Modifiers
- Types of Statement Modifiers
- do while/do until
- given/when
- Basic Syntax
- The Switch Module
- Summary
- Chapter 6: References
- References 101
- Array References
- Hash References
- Anonymous References
- Other References
- Working with References
- Debugging
- Copying
- Slices
- Summary
- Chapter 7: Subroutines
- Subroutine Syntax
- Argument Handling
- Multiple Arguments
- Named Arguments
- Aliasing
- State Variables (Pre-and Post-5.10)
- Passing a List, Hash, or Hashref?
- Returning Data
- Returning True/False
- Returning Single and Multiple Values
- wantarray
- FAIL!
- “Wake Up! Time to Die!”
- carp and croak
- eval
- evalGotchas
- Try::Tiny
- Subroutine References
- Existing Subroutines
- Anonymous Subroutines
- Closures
- Prototypes
- Argument Coercion
- More Prototype Tricks
- Mimicking Builtins
- Forward Declarations
- Prototype Summary
- Recursion
- Basic Recursion
- Divide and Conquer
- Memoization
- Things to Watch For
- Argument Aliasing
- Scope Issues
- Doing Too Much
- Too Many Arguments
- Summary
- Chapter 8: Regular Expressions
- Basic Matching
- Quantifiers
- Escape Sequences
- Extracting Data
- Modifiers and Anchors
- Character Classes
- Grouping
- Advanced Matching
- Substitutions
- Lookahead/Lookbehind Anchors
- Named Subexpressions (5.10)
- Common Regular Expression Issues
- Regexp::Common
- E-mail Addresses
- HTML
- Composing Regular Expressions
- Summary
- Chapter 9: Files and Directories
- Basic File Handling
- Opening and Reading a File
- File Test Operators
- The Diamond Operator
- Temporary Files
- DATA as a File
- binmode
- Directories
- Reading Directories
- Globbing
- Unicode
- What Is Unicode?
- Two Simple Rules
- Lots of Complicated Rules
- Useful Modules
- File::Find
- File::Path
- File::Find::Rule
- Summary
- Chapter 10: Sort, Map, and Grep
- Basic Sorting
- Sorting Alphabetically
- Sorting Numerically
- Reverse Sorting
- Complex Sort Conditions
- Writing a sort Subroutine
- Sorting and Unicode Fun!
- map and grep
- Using grep
- Using map
- Aliasing Issues
- Trying to Do Too Much
- Trying to Be Clever
- Putting It All Together
- Schwartzian Transform (aka decorate, sort, undecorate)
- Guttman-Rosler Transform
- Summary
- Chapter 11: Packages and Modules
- Namespaces and Packages
- use Versus require
- Package Variables
- Version Numbers
- Subroutines in Other Packages
- Exporting
- Naming Conventions
- BEGIN, UNITCHECK, CHECK, INIT, and END
- BEGIN blocks
- END Blocks
- INIT, CHECK, and UNITCHECK Blocks
- Plain Old Documentation (POD)
- Documentation Structure
- Headings
- Paragraphs
- Lists
- Verbatim
- Miscellaneous
- Creating and Installing Modules
- Creating a Simple Module
- Makefile.PL or Module::Build?
- Summary
- Chapter 12: Object Oriented Perl
- What Are Objects? The Ævar the Personal Shopper
- Three Rules of Perl OO
- Class Is a Package
- An Object Is a Reference That Knows Its Class
- A Method Is a Subroutine
- Objects – Another View
- Using TV::Episode
- Subclassing
- Using TV::Episode::Broadcast
- Class Versus Instance Data
- A Brief Recap
- Overloading Objects
- Using UNIVERSAL
- Understanding Private Methods
- Gotchas
- Unnecessary Methods
- “Reaching Inside”
- Multiple Inheritance
- Summary
- Chapter 13: Moose
- Understanding Basic Moose Syntax
- Using Attributes
- Using Constructors
- Understanding Inheritance
- Taking Care of Your Moose
- Advanced Moose Syntax
- Using Type Constraints
- Using Method Modifiers
- Understanding and Using Roles
- Exploring MooseX
- Rewriting Television::Episode
- Moose Best Practices
- Use namespace::autoclean and Make Your Class Immutable
- Never Override new()
- Always Call Your Parent BUILDARGS Method
- Provide Defaults if an Attribute is Not Required
- Default to Read-Only
- Put Your Custom Types in One Module and Give Them a Namespace
- Don’t Use Multiple Inheritance
- Always Consume All Your Roles at Once
- Summary
- Chapter 14: Testing
- Basic Tests
- Using Test::More
- Writing Your Tests
- Understanding the prove Utility
- Understanding Test::More Test Functions
- Using ok
- Using is
- Using like
- Using is_deeply
- Using SKIP
- Using TODO
- Using eval {}
- Using use_ok and require_ok
- Working with Miscellaneous Test Functions
- Using Other Testing Modules
- Using Test::Differences
- Using Test::Exception
- Using Test::Warn
- Using Test::Most
- Understanding xUnit Style Using Testing
- Using Test::Class
- A Basic Test Class
- Extending a Test Class
- Using Test Control Methods
- Calling Parent Test Control Methods
- Summary
- Chapter 15: The Interwebs
- A Brief Introduction to HTTP
- Plack
- Hello, World!
- Handling Parameters
- Templates
- Handling POST Requests
- Sessions
- Web Clients
- Extracting Links from Web Pages
- Extracting Comments from Web Pages
- Filling Out Forms Programmatically
- Summary
- Chapter 16: Databases
- Using the DBI
- Connecting to a Database
- Using SQLite
- Using DBD::SQLite
- Selecting Basic Data
- Using SELECT Statements
- Using Bind Parameters
- Inserting and Updating Data
- Creating Transactions
- Handling Errors
- Summary
- Chapter 17: Plays Well with Others
- The Command Line
- Reading User Input
- Handling Command-Line Arguments
- perlrun
- Other Programs
- Running an External Program
- Reading Another Program’s Output
- Writing to Another Program’s Input
- STDERR
- Summary
- Chapter 18: Common Tasks
- Using CSV Data
- Reading CSV Data
- Writing CSV Data
- Understanding Basic XML
- Reading CSV Data
- Writing CSV Data
- Handling Dates
- Using the DateTime Module
- Using Date::Tiny and DateTime::Tiny
- Understanding Your Program
- Using the Debugger
- Profiling
- Perl::Critic
- Summary
- Chapter 19: The Next Steps
- What Next?
- What This Book Covers
- What This Book Leaves Out
- Understanding Object-Relational Mappers
- Understanding DBIx::Class
- Understanding Basic DBIx::Class Usage
- Understanding the Pros and Cons of an ORM
- Using DBIx::Class::Schema::Loader
- Using the Template Toolkit
- Why Use Templates?
- An Introduction to Template Toolkit
- Using Catalyst to Build Apps
- The Beauty of MVC
- Setting Up a Catalyst Application
- Using Catalyst Views
- Using Catalyst Models
- Using Catalyst Controllers
- CRUD: Create, Read, Update, and Delete
- Summary
- Appendix: Answers to Exercises
- Chapter 3: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Chapter 4: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Chapter 5: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Exercise 5: Solution
- Exercise 6: Solution
- Chapter 6: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Chapter 7: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Chapter 8: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Chapter 9: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Exercise 5: Solution
- Chapter 10: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Chapter 11: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Exercise 5: Solution (Option)
- Chapter 12: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Chapter 13: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Chapter 14: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Chapter 15: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Chapter 16: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Chapter 17: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Chapter 18: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Exercise 4: Solution
- Exercise 5: Solution
- Chapter 19: Answers to Exercises
- Exercise 1: Solution
- Exercise 2: Solution
- Exercise 3: Solution
- Index
- Advertisement
Reviews
There are no reviews yet.