#!/usr/bin/perl
# ABSTRACT: Copy HTML Templates to Application Directory

use warnings;
use strict;

package dancer_datafu;
BEGIN {
  $dancer_datafu::VERSION = '0.0100';
}
use Dancer qw/:syntax/;
use Dancer::Plugin::DataFu;
use File::ShareDir ':ALL';
use File::Copy;
use Cwd;


sub copy_templates {
    my $to   = Cwd::getcwd();
    my $from = module_dir('Dancer::Plugin::DataFu') . "/elements";
    foreach my $tmpl ( glob path $from, '*.tt' ) {
            my ( $file, $name ) = $tmpl =~ /.*[\\\/]((\w+)\.tt)/;
            copy("$from/$file","$to/$file") or
            die "Dancer-Plugin-DataFu failed copying TT " .
                "HTML templates: $from/$file to $to/$file, $!";
    }
    print "Dancer-Plugin-DataFu copied TT HTML templates to $to\n";
}

# copy standard templates to the cwd
copy_templates;

1;
__END__
=pod

=head1 NAME

dancer_datafu - Copy HTML Templates to Application Directory

=head1 VERSION

version 0.0100

=head1 SYNOPSIS

This script will copy the default TT (Template-Toolkit) HTML form and grid/table
templates stored in the main Perl library, to the current working directory.

=head1 AUTHOR

Al Newkirk <awncorp@cpan.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2010 by awncorp.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

=cut

