DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Start Stop Script Template In Perl
// Start Stop script template in perl
#!/usr/bin/perl
use warnings;
use strict;
my $dispatch_table = {
'start' => \&start,
'stop' => \&stop,
};
my $options = join ' | ', sort keys %$dispatch_table;
die "Usage $0 [ $options ] " unless @ARGV;
my $argument = lc shift @ARGV;
die "Invalid option \"$argument\" \n Usage $0 [ $options ] " unless exists $dispatch_table->{ $argument };
$dispatch_table->{ $argument }->( );
exit 0;
# Define all function which you want to put in distpatch table below this line
sub start {
}
sub stop {
}






Comments
Snippets Manager replied on Mon, 2009/03/30 - 12:55am