September 2017
Beginner
402 pages
9h 52m
English
There are many more classes in the X:: namespace predefined in Perl 6. To see a full list of built-in exceptions, visit the following page— docs.perl6.org/type-exceptions.html. You can create your own class for your specific exceptions. We will first look at how to distinguish between the exceptions of different types in the CATCH block.
Let us create a program that tries to change the current working directory to a nonexistent one. In Perl 6, you can use the chdir function to change the directory:
chdir '/non-existing/directory';
The output shows the following error message:
Failed to change the working directory to '/non-existing/directory': does not exist in block <unit> at chdir.pl line 1
Now, let us see the type of the ...
Read now
Unlock full access