File: data.pl

package info (click to toggle)
libio-prompt-perl 0.997004-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 228 kB
  • sloc: perl: 846; makefile: 2
file content (49 lines) | stat: -rwxr-xr-x 1,328 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/perl

use IO::Prompt;

# The input is taken from the __PROMPT__ section below
#
# Hitting <return> immediately after the prompt will cause the next
# __PROMPT__ line to be typed in for you.
# Useful for pretending to type without bothering with the keyboard.
#
# Hitting any other key immediately after the prompt will put you into
# "smart typing" mode: the next __PROMPT__ line will be typed in
# for you, one letter for every key you hit (no matter what key you hit)
# Useful for pretending to type without looking at the keyboard.
#
# Hitting <escape> immediately after the prompt will escape from the
# automated input process and allow you to type whatever you like
#
# Because the __PROMPT__ section ends with a line containing only <ctrl>-D,
# input terminates when that line is reached. If the last line *didn't*
# contain the <ctrl>-D (or <ctrl>-Z if you prefer) then input would
# continue from the keyboard after all the __PROMPT__ lines were used
#

while (prompt -line, "\nNext line: ") {
    print "Input was: $_";
    while (<DATA>) {
        print "Datum was: $_";
        last;
    }
}

print "\n";
while (<DATA>) {
    print "Datum was: $_";
}

__DATA__
This is data line 1
This is data line 2
This is data line 3



This is data last line
__PROMPT__   
This is input line 1
This is input line 2