Advanced Perl programming : from advanced to expert / William "Bo" Rothwell
معرفی کتاب «Advanced Perl programming : from advanced to expert / William "Bo" Rothwell» نوشتهٔ William "Bo" Rothwell; SpringerLink (Online service)، منتشرشده توسط نشر Apress در سال 2020. این کتاب در فرمت pdf، زبان انگلیسی ارائه شده است.
William "Bo" Rothwell's Advanced Perl Programming continues where his previous book left off, more or less, as it guides you through advanced techniques of the Perl programming language starting with command-line options, references, and arrays and hashes from advanced data types. Next, you'll learn about typeglobs for symbolic entries. Additionally, you'll see advanced subroutine handling, then packages and namespaces. Furthermore, you'll build advanced modules and install CPAN modules. Unlike Java and C++, modules have been around in Perl for a long time now. Along the way, you'll learn and use POD mark up language for Perl documentation. Moreover, you'll get a survey of the many advanced features and data structures of the current Perl programming language. You'll also get a survey of the new features of the latest Perl 5.x release. After reading and using this book, you'll have the tools, techniques, and source code to be an expert Perl programmer. What You Will Learn Carry out command-line parsing and extract scripts Create references; return values from a reference; work with the ref Function and strict refs Work with advanced Perl data types using arrays, hashes, and hash of hashes Use Typeglobs for symbol table entries Build modules and install CPAN modules Write documentation for Perl using POD Work with the newest features in Perl, including the smartmatch operator, yada yada, automated regex modifiers, the CORE namespace and more Who This Book Is For Those with experience with Perl or who have read Rothwell's prior books, Beginning Perl Programming and Pro Perl Programming . Table of Contents About the Author About the Technical Reviewer Acknowledgments Chapter 1: Command-Line Options Changing input record separator Create a loop around your script Looping and printing Looping and parsing Editing in place Flexibility in backup filenames Backing up to different directories Syntax checking Pre-appending to @INC Manipulate @INC at compile time Using the -I option Including modules Using -M to load specific identifiers from modules Alternative syntax to -M Command-line parsing Displaying configuration information Extracting scripts from messages Handling extra text after end of script Additional resources Lab exercises Chapter 2: References Creating references Returning the value from a reference Other methods of referencing arrays Arrays of scalar references Another method of referencing hashes The ref function Making anonymous references Method #1 Method #2 Method #1 Method #2 References to functions use strict'refs' Making use of symbolic references Additional resources Lab exercises Chapter 3: Advanced Data Types: Arrays What you should already know about arrays Creating arrays Returning values in arrays Adding and removing elements in an array Looping through the array Array operators The reverse operator The sort operator The qw operator Array separator variable Regular expression matching with grep What you might know about arrays Changing $#array changes the size of the array Arrays returned in scalar context returns the number of elements in the array Changing the variable in a foreach loop changes the array elements The $_ variable is used by default in a foreach loop The foreach loop and for loops are the same thing Arrays of arrays Method #1 – Make an array for each data type Method #2 – Make an array for each transaction Method #3 – Make an array of arrays Creating arrays of arrays Rows and columns Creating a multi-dimensional array from STDIN Accessing values in an array of arrays Adding a subarray (row) Adding a column Printing an array of arrays Additional resources Lab exercises Chapter 4: Advanced Data Types: Hashes What you should already know about hashes Creating associative arrays Accessing values in an associative array Removing associative array keys and values exists vs. defined What you might know about hashes Keeping order in hashes Additional useful hash modules Inverting a hash: method #1 Inverting a hash: method #2 Hashes of hashes Approach #1 – Make four arrays, one for each student Approach #2 – Make three associative arrays, one for each test Approach #3 – Make a hash of hashes Creating hashes of hashes Accessing values in a hash of hashes Accessing one element Accessing the entire hash Other data structures Revisiting reversing a hash Additional resources Lab exercises Chapter 5: Typeglobs Virtual representation of a symbolic table Typeglobs Using typeglobs Making a typeglob Accessing the original variables via the alias Removing the alias References vs. typeglobs Avoiding aliases to entire identifier Making constants Passing filehandles into functions Redefining a function Redefining functions without using other functions Temporarily redefining a function Nesting functions Additional resources Lab exercises Chapter 6: Advanced Subroutine Handling What you should already know about subroutines Declaring subroutines Invoking subroutines Returning values from functions The explicit method The implicit method Passing parameters Parameters are passed as references Scope of variables The local statement The my statement use strict Pre-declaring subroutines What you might know about subroutines Functions vs. subroutines Parameters are passed in as a single flat list Return values are passed out in a single flat list Reassigning the @_ array breaks the references The @_ array can be inherited from the calling program my variables affect blocks, not just subroutines You can’t my all variables my variables are not created until after the statement is complete Nested functions have their own my variables Foreach loops use local variable, but they can be my variables While my is preferred, local is still useful Making persistent function variables Using the caller function Passing arguments by reference Determining functions return data Returning multiple values Exception handling Constant functions Prototypes Prototype characters Additional resources Lab exercises Chapter 7: Packages and Namespaces Creating namespaces with the package command Fully qualified package names Alternative method Nested packages Declaring "nested" packages Accessing identifiers from nested packages use strict'vars' use strict'vars' The "use vars" pragma use vars is obsolete Identifiers not affected by packages Determine the current package Packages vs. my variables The our statement Additional resources Lab exercises Chapter 8: Building Modules Creating a module BEGIN and END blocks BEGIN blocks END blocks Symbol tables in modules Exporting identifiers from modules Private identifiers Oking symbols to export from modules Module version numbers use vs. require A note about library files Additional resources Online Lab exercises Chapter 9: Installing CPAN Modules Accessing CPAN CPAN organization The menu bar The main page Searching for modules I found a good module, now what? Installing a CPAN module manually Installing CPAN modules using the CPAN module Listing available commands Listing available modules Installing modules Using the Perl Package Manager to install modules Starting ppm Displaying packages Accessing repositories Installing modules Deleting packages Listing what modules are currently installed Additional resources Books Online Lab exercises Chapter 10: POD POD commands Using headings Starting and ending POD text Using other formats Using POD to create multi-line comments Creating a list POD text POD verbatim POD examples Common POD problems POD utilities podchecker perldoc Additional utilities POD style Additional resources Lab exercises Chapter 11: Advanced Features Perl development environments *nix/Windows Which derivative for *nix? Which derivative for Windows? Pick your Perl development tools The power of the do statement Loop control with do Sourcing code An additional feature of the do statement autodie autodie scope Using eval with autodie Why not use Fatal? Humorous autodie side note String variables as files File::Spec Proper use of soft references Install modules from CPAN without admin privileges Bootstrapping Basic testing Advanced testing Using prove Useful prove options Additional test modules Benchmarking Basic benchmarking :hireswallclock Chapter 12: Advanced Data Structures Use the Readonly module to create constants Make large numbers more readable Make use of Scalar::Util dualvar looks_like_number Make use of List::Util first max, maxstr, min, and minstr reduce shuffle sum Make use of List::MoreUtils List formatting On a related note... Understand slices Make use of Hash::Util lock_keys, unlock_keys, and lock_keys_plus lock_value and unlock_value lock_hash and unlock_hash hash_unlocked legal_keys, hidden_keys, and all_keys Make use of Hash::MoreUtils Smart use of subscripts Example #1 – Avoid array subscripts Example #2 – Avoid hash subscripts Example #3 – Proper use of subscript Understand the advantages and disadvantages of for, foreach, grep, and map Return based on regular expression matching Modifying the original array Using substitution to make a modified copy of the original Know different sort techniques Customized sorts Sort by file modification time Hash value sorting Complex sorting example The Orcish Maneuver Avoid using memory to store large data Creating temporary files OO nature of File::Temp Chapter 13: New Features The latest, greatest? The feature pragma Example of use feature'say' and use feature'state' The given statement An alternative format for when Pattern matches with given The default comparison for given Using continue with given New foreach technique Using __SUB__ Using all features of a specific Perl version features are lexically scoped Make use of the Smartmatch operator Using regex expressions Additional Smartmatches The given statement Use Perl 5.10.1 or higher The // operator The UNITCHECK block Small changes in Perl 5.10 Yada yada Using each, keys, and values with arrays Small changes in Perl 5.12 New regular expression modifiers Nondestructive substation Automating regular expression modifiers New feature for given Small changes in Perl 5.14 Change in use feature The CORE namespace Overriding Perl keywords Small changes in Perl 5.16 Changes beyond Perl 5.16 Index
دانلود کتاب Advanced Perl programming : from advanced to expert / William "Bo" Rothwell