Gain the skills to begin developing Perl 6 applications from the ground up in this hands-on compact book, which includes a foreword from Larry Wall, creator of Perl. You’ll learn enough to get started building with Perl 6, using Perl 6’s gradual typing, handy object orientation features, powerful parsing capabilities, and human-usable concurrency. After a short introduction, each chapter develops a small example project, explaining the Perl 6 features used. When the example is done, you’ll explore another aspect, such as optimizing further for readability or testing the code.
Along the way you’ll see Perl 6 basics, such as variables and scoping; subroutines; classes and objects; regexes; and code testing. When you’ve mastered the basics,
Perl 6 Fundamentals moves onto more advanced topics to give you a deeper understanding of the language. You’ll learn, amongst other things, how to work with persistent storage, how to generate good error messages, and how to write tricky applications such as a file and directory usage graph and a Unicode search tool.
What You’ll Learn
- Get coding with Perl 6
- Work on several hands-on examples and projects
- Integrate Python libraries into your Perl 6 programs
- Parse INI files using regexes and grammars
- Build a date time converter
- Carry out refactoring and other automated tests
Who This Book Is For
If you already know one or more programming languages, and want to learn about Perl 6, this book is for you.
Table of Content
1. What is Perl 6?
1.1 Perl 5, the Older Sister
1.2 Library Availability
1.3 Why Should I Use Perl 6?
2. Running Rakudo Perl 6
2.1 Installers
2.2 Docker
2.3 Building from Source
2.4 Testing your Rakudo Star Installation
3. Formatting a Sudoku Puzzle
3.1 Making the Sudoku Playable
3.2 Shortcuts, Constants, and more Shortcuts
3.3 IO and other Tragedies
3.4 Get Creative!
4. Datetime Conversion for the Command Line
4.1 Libraries To The Rescue
4.2 Date Time Formatting
4.3 Looking the Other Way
4.4 Dealing With Time
4.5 Tighten Your Seat Belt
4.6 MAIN magic
4.7 Automatic Tests
4.8 Summary
5. Testing say()
5.1 Summary
6. Silent Cron, a Cron Wrapper
6.1 Running Commands Asynchronously
6.2 Implementing Timeouts
6.3 More on Promises
6.4 Possible Extensions
6.5 Refactoring and Automated Tests
Refactoring
Mocking and Testing
Improving Reliability and Timing
Installing a Module
6.6 Summary
7. Stateful Silent Cron
7.1 Persistent Storage
7.2 Developing the Storage Backend
7.3 Using the Storage Backend
7.4 Room for Expansion
7.5 Summary
8. Review of the Perl 6 Basics
8.1 Variables and Scoping
8.2 Subroutines
8.3 Classes and Objects
8.4 Concurrency
8.5 Outlook
9. Parsing INI files using Regexes and Grammars
9.1 Regex Basics
Character Classes
Quantifiers
Alternatives
9.2 Parsing the INI primitives
9.3 Putting Things Together
9.4 Backtracking
9.5 Grammars
9.6 Extracting Data from the Match
9.7 Generating Good Error Messages
Failure is Normal
Detecting Harmful Failure
Providing Context
Shortcuts for Parsing Matching Pairs
9.8 Write Your Own Grammars
9.9 Summary
10. A File and Directory Usage Graph
10.1 Reading File Sizes
10.2 Generating a Tree Map
10.3 Flame Graphs
10.4 Functional Refactorings
10.5 More Language Support for Functional Programming
10.6 More Improvements
10.7 Explore!
10.8 Summary
11. A Unicode Search Tool
11.1 Code Points, Grapheme Clusters and Bytes
11.2 Numbers
11.3 Other Unicode Properties
11.4 Collation
11.5 Summary
12. Plotting Using Inline::Python and Matplotlib
13. What’s Next?
About the author
Moritz Lenz is a Perl 6 core developer. He has contributed significantly to the official test suite, the Rakudo Perl 6 compiler, and is the initiator of the official Perl 6 documentation project. He has also authored several modules, and runs infrastructure for the Perl 6 community. In his day job, he develops Perl 5 and Python code, and maintains a Continuous Delivery system for his employer.
Language English ● Format PDF ● Pages 142 ● ISBN 9781484228999 ● File size 2.7 MB ● Publisher Apress ● City CA ● Country US ● Published 2017 ● Downloadable 24 months ● Currency EUR ● ID 5215775 ● Copy protection Adobe DRM
Requires a DRM capable ebook reader