Skip to content

Instantly share code, notes, and snippets.

@jshirley
Created October 2, 2009 18:39
Show Gist options
  • Save jshirley/199990 to your computer and use it in GitHub Desktop.
Save jshirley/199990 to your computer and use it in GitHub Desktop.
package MyApp;
use Moose;
with 'MooseX::Role::Environment';
=head1 SYNOPSIS
Simple usage! After you have the default 'myapp.yml', go nuts (look at http://gist.github.com/198143)
perl -MMyApp -e 'MyApp->new->run';
=cut
coerce 'MyApp::Thing',
from HashRef,
via { MyApp::Thing->new_with_traits( $_ ) };
has 'thing' => (
is => 'ro',
isa => 'MyApp::Thing',
coerce => 1
);
has '+configfile' => ( default => sub { shift->path_to('myapp.yml')->stringify } );
sub run {
my ( $self ) = @_;
# Oh, how contrived.
my $output = $self->path_to("data")->file("output.log");
my $thing = $self->thing->do_it( $output );
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment