This repository was archived by the owner on Nov 15, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change
1
+ # !/usr/bin/env perl6
2
+
3
+ use v6.c ;
4
+
5
+ use Pod ::To::Text;
6
+
7
+ use Lingua::Palindrome;
8
+
9
+ multi MAIN (* @ item , Str : m(: $ mode )) {
10
+ given $ mode {
11
+ when ' char' { exit +! char-palindrome(@ item . join (' ' )) }
12
+ when ' word' { exit +! word-palindrome(@ item . join (' ' )) }
13
+ when ' line' {
14
+ my @ status = map {line-palindrome(. IO )}, @ item ;
15
+ exit +! all (@ status );
16
+ }
17
+ default {
18
+ say ' Unknown mode!' ;
19
+ exit 1 ;
20
+ }
21
+ }
22
+ }
23
+
24
+ multi MAIN (Bool : h(: $ help )) {
25
+ say pod2text($ = pod );
26
+ }
27
+
28
+ multi MAIN (Bool : V(: $ version )) {
29
+ say " Author: " ~ Lingua::Palindrome.^ auth;
30
+ say " Version: " ~ Lingua::Palindrome.^ ver;
31
+ }
32
+
33
+ = begin pod
34
+
35
+ = head1 NAME
36
+
37
+ palindrome - Check whether words form a palindrome
38
+
39
+ = head1 SYNOPSIS
40
+
41
+ The exit status is 0 if the given words form a palindrome, nonzero otherwise.
42
+
43
+ Usage:
44
+ palindrome [-m|--mode=<Str>] [<item> ...]
45
+
46
+ palindrome [-h|--help]
47
+ palindrome [-V|--version]
48
+
49
+ Examples:
50
+
51
+ palindrome --mode=char 'Was it a car or a cat I saw?'
52
+ palindrome --mode=word 'Fall leaves after leaves fall.'
53
+ palindrome --mode=line foo.txt bar.txt
54
+
55
+ = end pod
You can’t perform that action at this time.
0 commit comments