File: record.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 (27 lines) | stat: -rwxr-xr-x 734 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
#!/usr/bin/perl

use IO::Prompt -record;

# Loading the module with the -record flag causes it to record all inputs
# which are written to a file named ./__PROMPT__
#
# The contents of ./__PROMPT__ are suitable for appending as your __DATA__
# section to recreate the input process that was recorded (but don't forget to
# remove the -record flag first!)
#

prompt "next: ", -integer, -require => {
    'next (must be > 0):' => sub { $_ > 0 }
};
print "[$_]\n";

prompt "base: ", -i, -req => {
    '%s(an even number, please) ' => sub { $_ % 2 == 0 }
};
print "[$_]\n";

prompt "base: ", -req => { 'base [ACGT]: ' => qr/^[ACGT]$/ };
print "[$_]\n";

prompt "base: ", -req => { 'base [ACGT]: ' => [qw(A C G T skip)] };
print "[$_]\n";