-
Notifications
You must be signed in to change notification settings - Fork 1
/
perl-script-template.pl
executable file
·71 lines (56 loc) · 1.3 KB
/
perl-script-template.pl
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env perl
# -*-mode:cperl -*-
=pod
Description:
This script makes developer happier.
Usage:
1. edit the parts under the section '#-- arguments --'.
2. run script
Date created: 2013-07
Author: Fedor Sumkin
=cut
use strict;
use warnings;
use Data::Dumper qw ( Dumper );
use Getopt::Long qw ( GetOptions );
use 5.008003; # may be newer
########################################################################
my $VERSION = '0.8.0';
## Set defaults for all the options, then read them in from command line
my %arg = (
verbose => 0,
quiet => 0,
debug => 0,
help => 0,
mode => 0
);
########################################################################
my $result = GetOptions (
\%arg,
'verbose',
'quiet',
'debug',
'help|h',
'mode=s'
) or help();
$arg{help} and help();
print "================\n";
print "ARG ARRAY => ".Dumper \%arg;
print "================\n";
########################################################################
sub main
{
if($arg{mode} eq 'god') {
print "God mode\n";
exit 0;
}
}
########################################################################
sub help
{
print "Usage: $0 configfile [options]\n";
print " For full documentation, please visit:\n";
print " http://some_host\n";
exit 0;
}
main();