2023-07-04
Using Comma IDE to Debug the First Perl 6 Script
You wouldn't believe how much hassle there always is from installing a GUI IDE to actually debugging a piece of code in it. As 汪峰's line of lyric goes, 「就像霓虹燈到月亮的距離」 (It's like the distance between the neon light to the moon.)
Pic or it didn't happen
And by the way, happy Fourth of July!
The hoops
#project/learn-by-doing
#project/started
Evidence of Perl 6 support
Checking out the Plugins section of the left-nav pane, I found "Comma Community Edition (Raku Language Support)" bundled and installed. This is a very encouraging sign.
Create the first project with a Perl 6 script
To make a long story short, creating a project, a Perl 6 script file (with .p6 extension), and supplying actual Perl 6 code in it aren't enough. When I tried to run it, it complained of missing the SDK. It took some Googling to get some handholding from the kindness of a random stranger (from Stackexchange as I recall) to do this:
File > Project Structures > Project Settings > Project
and browse to the perl6 interpreter path (/usr/bin/perl6
) (remember to use the trick to reveal hidden directories on Finder) to add the SDK:
Mark project directory as Sources Root
This step is even more obscure. Without doing this, Comma kept reporting failure to locate Test (which I didn't have) in the project directory, and refused to run the script.
Add a Run Configuration for scripts (not Tests)
Per Comma doc, Run > Edit Configurations...
Under 'Raku', click the plus sign to create a configuration to the specific script to be run:
Yes, 🙄 the script must be manually browsed to, like this:
Nth time's the charm
Only then was I able to run or debug the Perl 6 script, as shown at the top of this page.
Despite the amazingly labyrinthine process, I'm glad tenacity paid off again.