Skip to content

Commit f4282ff

Browse files
committed
add 15interactivity to HTML and tweak it
1 parent 4e3e0eb commit f4282ff

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

categories/cookbook/15interactivity/15-01-parse-program-args.pl

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,10 @@
1010
1111
=end pod
1212

13-
# output is required parameter
14-
sub MAIN (Str :$output!, Bool :$debug = False ) {
15-
say @*ARGS.perl; # direct way
16-
say :$output.perl, :$debug.perl; # better way
13+
#| open file, whatever
14+
sub MAIN (Str :$output!, Bool :$debug = False ) { # False can be ommitted
15+
warn "debugging" if $debug;
16+
dd $output;
1717
}
1818

19-
# % perl6 15-01-parse-program-args.pl
20-
# Usage:
21-
# 15-01-parse-program-args.pl --output=<Str> [--debug]
22-
23-
# % perl6 15-01-parse-program-args.pl --output=foo
24-
# Array.new("--output=foo")
25-
# "output" => "foo""debug" => Bool::False
26-
2719
# vim: expandtab shiftwidth=4 ft=perl6

categories/cookbook/15interactivity/15-02-test-interactive-program.pl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@
1111
1212
=end pod
1313

14+
# this doesn't currently (Aug 2015) work on MoarVM since
15+
# isatty isn't implemented
1416
# https://rt.perl.org/Ticket/Display.html?id=123347
17+
#
1518
sub I-am-interactive {
1619
return $*IN.t && -t $*OUT.t;
1720
}

categories/cookbook/15interactivity/15-03-clear-screen.pl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
99
=end pod
1010

11-
# TODO fix on windows
11+
# TODO check on windows
12+
# TODO control code sequence probably better
1213

1314
shell "clear";
1415

htmlify.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ (:$no-highlight = False)
5353
"10subroutines" => "10. Subroutines",
5454
"13classes-objects-and-ties" => "13. Classes, Objects and Ties",
5555
"14database-access" => "14. Database Access",
56+
"15interactivity" => "15. Interactivity",
5657
"16processes" => "16. Processes",
5758
"17sockets" => "17. Sockets",
5859
"19cgi-programming" => "19. CGI programming",

0 commit comments

Comments
 (0)