| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use Getopt::Long; | ||
| 6 | use App::ProcTrends::Commandline; | ||
| 7 | |||
| 8 | exit( main() ); | ||
| 9 | |||
| 10 | sub main { | ||
| 11 | my $ref = {}; | ||
| 12 | |||
| 13 | GetOptions( | ||
| 14 | $ref, | ||
| 15 | "start=s", | ||
| 16 | "end=s", | ||
| 17 | "interval=i", | ||
| 18 | "procs=s", | ||
| 19 | "command=s", | ||
| 20 | "rrd_dir=s", | ||
| 21 | "out_dir=s", | ||
| 22 | "debug", | ||
| 23 | ); | ||
| 24 | |||
| 25 | my $obj = App::ProcTrends::Commandline->new( $ref ); | ||
| 26 | my $command = $obj->command(); | ||
| 27 | |||
| 28 | my $handler = "${command}_handler"; | ||
| 29 | if ( $obj->can( $handler ) ) { | ||
| 30 | $obj->$handler(); | ||
| 31 | } | ||
| 32 | else { | ||
| 33 | die "command $command not supported\n"; | ||
| 34 | } | ||
| 35 | } |