Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Template for MT::Tool::Foo
#!/usr/bin/perl
package MT::Tool::Foo;
use strict;
use warnings;
use File::Spec;
use FindBin;
use lib map File::Spec->catdir( $FindBin::Bin, File::Spec->updir, $_ ), qw/lib extlib/;
use base qw( MT::Tool );
sub usage { '--debug 1' }
sub help {
return q {
Description Foo.
--debug 1
};
}
my ( $debug );
sub options {
return (
'debug=s' => \$debug,
);
}
sub main {
my $class = shift;
my ( $verbose ) = $class->SUPER::main( @_ );
if ( $debug ) {
print 'Some debug message.' ."\n";
}
# Do something.
1;
}
__PACKAGE__->main() unless caller;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment