about summary refs log tree commit diff stats
path: root/lib/Octans
diff options
context:
space:
mode:
authorAndinus <andinus@nand.sh>2021-02-19 22:59:07 +0530
committerAndinus <andinus@nand.sh>2021-02-19 23:08:26 +0530
commitc029e07dd1fea194a674fe9dfee35e3c7a63be06 (patch)
tree96168e700c70b5d4fe2b70e473fbbfdd9dd07f64 /lib/Octans
parent151186cad17539451efe7f201c66b689d754ae1a (diff)
downloadoctans-c029e07dd1fea194a674fe9dfee35e3c7a63be06.tar.gz
Fix the sample puzzle error
It would error out when the user runs sample puzzle because we're
using $path.IO.f but that wasn't passed.

It prints this error:

    Invocant of method 'f' must be an object instance of type
    'IO::Path', not a type object of type 'IO::Path'.
Diffstat (limited to 'lib/Octans')
-rw-r--r--lib/Octans/CLI.rakumod10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Octans/CLI.rakumod b/lib/Octans/CLI.rakumod
index 8abfef8..4522571 100644
--- a/lib/Octans/CLI.rakumod
+++ b/lib/Octans/CLI.rakumod
@@ -44,10 +44,12 @@ multi sub MAIN (
     }
 
     # Get the puzzle from $path if it's passed.
-    if $path.IO.f {
-        @puzzle = $path.IO.lines.map(*.words.cache.Array);
-    } else {
-        @puzzle = get-puzzle($path);
+    with $path {
+        if $path.IO.f {
+            @puzzle = $path.IO.lines.map(*.words.cache.Array);
+        } else {
+            @puzzle = get-puzzle($path);
+        }
     }
 
     # set-gray-squares also removes asterisks from @puzzle.