📘 Whatever (*) and WhateverCode in Perl 6

In Perl 6, the star character * can be associated with one of the predefined classes, Whatever and WhateverCode. We’ll start with an object of the Whatever class. say *.WHAT; # (Whatever) The construction like 1 .. * creates a Range object, where its upper limit is not fixed to any particular number. say (1 … Continue reading “📘 Whatever (*) and WhateverCode in Perl 6”

📘 Programming for the Internet in Perl 6

The simplest way to build a web server in Perl 6 is to use a PSGI server called Bailador. This is a module that you can find on the official page with the list of Perl 6 modules: modules.perl6.org. If you are using the Rakudo Star distribution, use the panda* command line utility to install … Continue reading “📘 Programming for the Internet in Perl 6”

📘 Unicode in Perl 6

The strings in Perl 6 are internally handled in the format called NFG (Normalization Form Grapheme). From a practical point of view, that means that, for any symbol, you can get its NFC, NFD, NFKC and KFKD forms. I will refer you to read about the details of these formats to the Unicode standard. In … Continue reading “📘 Unicode in Perl 6”

📘 Working with files and directories in Perl 6

To get the content of a file, use the slurp built-in function, which reads the whole file and returns a string. say slurp “file.txt”; The function that does the opposite is called spurt, it writes the string to a file. Let us implement the Unix’s cp command in Perl 6. my ($source, $dest) = @*ARGS;  … Continue reading “📘 Working with files and directories in Perl 6”

📘 Database access in Perl 6

Install the DBIish module to get a powerful tool for working with databases*: $ panda install DBIish You also will need the database driver; for example, libmysqlclient for working with MySQL. Check the documentation of the DBIish module on modules.perl6.org if you want to work with a different database engine. The module provides an interface … Continue reading “📘 Database access in Perl 6”