summaryrefslogtreecommitdiff
path: root/test/module/test.pl
blob: 0d5a9d09b3faa19d6bea6b38987045576ef43280 (plain)
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
50
51
52
53
54
#!/usr/bin/perl

use Getopt::Long;
use IO::Handle;

STDERR->autoflush(1);
STDOUT->autoflush(1);

my $train;
my $test;
my $wait;
my $buzz;
GetOptions (
  "train"  => \$train,
  "test"  => \$test,
  "wait"  => \$wait,
  "buzz"  => \$buzz,
)
or die("Error in command line arguments\n");

print "hello i am a perl script :o)\n";

if ($train) {
  print "we are training...\n";
  for (my $i = 0; $i < 11; $i++) {
    print "$i...\n";
    sleep 1;
  }
} elsif ($test) {
  print "we are testing...\n";
  for (my $i = 0; $i < 11; $i++) {
    print "$i...\n";
    sleep 1;
  }
} elsif ($wait) {
  print "we are waiting...\n";
  for (my $i = 0; $i < 5; $i++) {
    print "$i...\n";
    sleep 1;
  }
} elsif ($buzz) {
  print "we are buzzing!!!!!\n";
  for (my $i = 0; $i < 7; $i++) {
    print "$i...!\n";
    sleep 1;
  }
  print "catch the buzzz!\n";
} else {
  die "unknown command!";
}

print 'done!';

exit;