Skip to content

Instantly share code, notes, and snippets.

@genehack
Created April 13, 2010 01:28
Show Gist options
  • Save genehack/364217 to your computer and use it in GitHub Desktop.
Save genehack/364217 to your computer and use it in GitHub Desktop.
MooseX::App::Cmd + MooseX::SimpleConfig
package App::Booklist::CLI::BASE;
use Moose;
use namespace::autoclean;
use 5.010;
extends 'MooseX::App::Cmd::Command';
with 'MooseX::SimpleConfig';
has file => (
isa => 'Str' ,
is => 'rw' ,
documentation => 'Location of DB file.' ,
traits => [qw(Getopt)],
default => "$FindBin::Bin/../db/booklist.db",
);
sub get_schema_and_deploy_db_if_needed {
my( $self ) = shift;
my $db = $self->file;
return $self->deploy_db()
unless -e $db;
return $self->get_schema;
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment