App-DBI-Loader

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

         "requires" : {
            "Pod::Coverage::TrustPod" : "0",
            "Test::Pod" : "1.41",
            "Test::Pod::Coverage" : "1.08"
         }
      },
      "runtime" : {
         "requires" : {
            "DBI" : "0",
            "Getopt::Config::FromPod" : "0",
            "String::Unescape" : "0",
            "perl" : "5.006"
         }
      },
      "test" : {
         "requires" : {
            "File::Spec" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",
            "Test::Exception" : "0",
            "Test::More" : "0"

META.yml  view on Meta::CPAN

dynamic_config: 0
generated_by: 'Dist::Zilla version 5.006, CPAN::Meta::Converter version 2.132140'
license: perl
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: App-DBI-Loader
requires:
  DBI: 0
  Getopt::Config::FromPod: 0
  String::Unescape: 0
  perl: 5.006
resources:
  homepage: https://github.com/yak1ex/App-DBI-Loader
  repository: https://github.com/yak1ex/App-DBI-Loader.git
version: v0.0.2

Makefile.PL  view on Meta::CPAN

  },
  "DISTNAME" => "App-DBI-Loader",
  "EXE_FILES" => [
    "bin/dbiloader"
  ],
  "LICENSE" => "perl",
  "NAME" => "App::DBI::Loader",
  "PREREQ_PM" => {
    "DBI" => 0,
    "Getopt::Config::FromPod" => 0,
    "String::Unescape" => 0
  },
  "TEST_REQUIRES" => {
    "File::Spec" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::Exception" => 0,
    "Test::More" => 0
  },
  "VERSION" => "v0.0.2",
  "test" => {

Makefile.PL  view on Meta::CPAN

  }
);


my %FallbackPrereqs = (
  "DBI" => 0,
  "File::Spec" => 0,
  "Getopt::Config::FromPod" => 0,
  "IO::Handle" => 0,
  "IPC::Open3" => 0,
  "String::Unescape" => 0,
  "Test::Exception" => 0,
  "Test::More" => 0
);


unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

dist.ini  view on Meta::CPAN

copyright_holder = Yasutaka ATARASHI
copyright_year   = 2013

version = v0.0.2

[@Author::YAKEX]

[Prereqs / RuntimeRequires]
Getopt::Config::FromPod = 0
DBI = 0
String::Unescape = 0

[Prereqs / TestRequires]
Test::More = 0
Test::Exception = 0

[Prereqs / TestSuggests]
DBD::SQLite = 0

lib/App/DBI/Loader.pm  view on Meta::CPAN

use warnings;

# ABSTRACT: A tiny script to load CSV/TSV contents into a database table via DBI
our $VERSION = 'v0.0.2'; # VERSION

use Getopt::Std;
use Getopt::Config::FromPod;
use Pod::Usage;

use DBI;
use String::Unescape;

sub run
{
    shift if @_ && eval { $_[0]->isa(__PACKAGE__) };
    local (@ARGV) = @_;

    my %opts;
    getopts(Getopt::Config::FromPod->string, \%opts);
    pod2usage(-verbose => 2) if exists $opts{h};
    pod2usage(-msg => 'At least 2 arguments MUST be specified', -verbose => 0, -exitval => 1) if @ARGV < 2;
    push @ARGV, '-' if @ARGV == 2;

    $opts{t} ||= '';
    my $sep = String::Unescape->unescape($opts{t}) || ',';

    my $dbstr = shift @ARGV;
    my $table = shift @ARGV;

    my $dbh = DBI->connect($dbstr, $opts{u} || '', $opts{p} || '') or die;
    my $has_transaction = 1;
    eval { $dbh->{AutoCommit} = 0 };
    $has_transaction = 0 if $@;
    if($ARGV[0] =~ /\(.*\)/) {
        my $schema = shift @ARGV;



( run in 0.742 second using v1.01-cache-2.11-cpan-c21f80fb71c )