end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

Amon2によるバッチプログラム(CLI)の作成

更に先程のエントリの続きです
http://amon.64p.org/cli.html
↑こちらに記載されている通りですけど、bootstrap() でコンテキストを取得できるので、後は、DB処理等をお好きに

#!/usr/local/bin/perl
use strict;
use FindBin;
use File::Spec;
use lib File::Spec->catdir($FindBin::Bin, '/amon2/TestAmon2App/lib');
use TestAmon2App;
use Data::Dumper;

main();

sub main {
    my $c = TestAmon2App->bootstrap();
    $c->info('This is info log for test by batch program.');

    #後はお好きに...
}