Skip to content

Instantly share code, notes, and snippets.

@alfasado
Created November 29, 2012 09:26
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alfasado/4167792 to your computer and use it in GitHub Desktop.
Save alfasado/4167792 to your computer and use it in GitHub Desktop.
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