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

!../_attachments/Screen Shot 2023-07-06 at 11.57.57.png

And by the way, happy Fourth of July!

via GIPHY

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.

!../_attachments/Screen Shot 2023-07-06 at 12.58.34.png

Create the first project with a Perl 6 script

!500

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:

!500

!../_attachments/Screen Shot 2023-07-06 at 13.34.45.png

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.

!500

Add a Run Configuration for scripts (not Tests)

Per Comma doc, Run > Edit Configurations...

!300

Under 'Raku', click the plus sign to create a configuration to the specific script to be run:

!../_attachments/Screen Shot 2023-07-06 at 11.47.41.png

Yes, 🙄 the script must be manually browsed to, like this:

!500

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.