From: Matt S Trout Date: Fri, 11 Nov 2011 12:21:41 +0000 (+0000) Subject: completely missed this X-Git-Tag: v0.001001~13 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=511c36fe6baddc9aab75cd299af7380099a08be4;p=scpubgit%2FTak.git completely missed this --- diff --git a/lib/App/Tak.pm b/lib/App/Tak.pm new file mode 100644 index 0000000..2acd5ee --- /dev/null +++ b/lib/App/Tak.pm @@ -0,0 +1,29 @@ +package App::Tak; + +use Moo; + +has env => (is => 'ro', required => 1); + +sub new_from_environment { + my $class = shift; + my %env = ( + env => { %ENV }, argv => [ @ARGV ], + stdin => \*STDIN, stdout => \*STDOUT, stderr => \*STDERR + ); + $class->new(env => \%env); +} + +sub run { + my ($self) = @_; + my @argv = @{$self->env->{argv}}; + require Tak::MyScript; + my $opt = Tak::MyScript->_parse_options( + 'config|c=s;host|h=s@;local|l!;verbose|v+;quiet|q+', \@argv + ); + Tak::MyScript->new( + options => $opt, + env => { %{$self->env}, argv => \@argv } + )->run; +} + +1;