#!/usr/bin/env perl
use strict;
use warnings;
# PODNAME: reply
# ABSTRACT: read, eval, print, loop, yay!

use File::HomeDir;
use File::Spec;

use Reply;


my $cfg = File::Spec->catfile(File::HomeDir->my_home, ".replyrc");

my %args = (config => $cfg);
if (!-e $cfg) {
    print("$cfg not found. Generating a default...\n");
    if (open my $fh, '>', $cfg) {
        my $contents = do {
            local $/;
            <DATA>
        };
        $contents =~ s/use 5.XXX/use $]/;
        print $fh $contents;
        close $fh;
    }
    else {
        warn "Couldn't write to $cfg";
        %args = ();
    }
}

Reply->new(%args)->run;

=pod

=head1 NAME

reply - read, eval, print, loop, yay!

=head1 VERSION

version 0.02

=head1 SYNOPSIS

  reply

=head1 DESCRIPTION

This script runs the L<Reply> shell. It looks for a configuration file in
C<.replyrc> in your home directory, and will generate a basic configuration for
you if that file does not exist.

See the L<Reply> documentation for more information about using and configuring
this program.

=head1 AUTHOR

Jesse Luehrs <doy at cpan dot org>

=head1 COPYRIGHT AND LICENSE

This software is Copyright (c) 2013 by Jesse Luehrs.

This is free software, licensed under:

  The MIT (X11) License

=cut

__DATA__
script_line1 = use strict
script_line2 = use warnings
script_line3 = use 5.XXX

[Interrupt]
[FancyPrompt]
[DataDumper]
[Colors]
[ReadLine]
[Hints]
[Packages]
[LexicalPersistence]
[ResultCache]
