Group
Extension

Daje-Generate/lib/Daje/Generate/Output/Sql/Table.pm

use v5.40;
use feature 'class';
no warnings 'experimental::class';


our $VERSION = '0.01';

class Daje::Generate::Output::Sql::Table {
    use Mojo::File;

    field $config :param ;
    field $file :param;
    field $sql :param;

    method save_file() {

        my $filename = $self->create_new_filename();
        open (my $fh, ">", $filename) or die "Could not open file '$filename";
        print $fh $sql;
        close $fh;

        return;
    }

    method create_new_filename() {
        my $filename;
        try {
            $filename = $config->{PATH}->{sql_target_dir} . Mojo::File->new($file)->basename();
            $filename =~ s/json/sql/ig;
        } catch ($e) {
            die "create_new_filename failed '$e'";
        };

        return $filename;
    }
}




1;

#################### pod generated by Pod::Autopod - keep this line to make pod updates possible ####################

=head1 NAME

lib::Daje::Generate::Output::Sql::Table - lib::Daje::Generate::Output::Sql::Table


=head1 DESCRIPTION

pod generated by Pod::Autopod - keep this line to make pod updates possible ####################


=head1 REQUIRES

L<Mojo::File> 

L<feature> 

L<v5.40> 


=head1 METHODS


=cut



Powered by Groonga
Maintained by Kenichi Ishigaki <ishigaki@cpan.org>. If you find anything, submit it on GitHub.