プラグイン書いたり

$self->say(scalar(localtime), " $src");
$self->say("  move $src => $dest");
my @tags = $self->getCategory($src);
my %image;
my $temp = (File::Spec->splitpath($dest))[2];
if ($self->_debug) {
    File::Copy::copy $src, $temp or croak $!;
}
else {
    CORE::rename $src, $temp or croak $!;
}
my $img = Image->new(file => $temp) or croak $!;
@image{qw/width height filesize post/} = ($img->get(qw/width height filesize/), time);
($image{image_id} = $temp) =~ s/\.\w+$//i;
($image{extension} = $temp) =~ s/\.(\w+)$/$1/i;
$image{original_name} = $src;
my $thumb = $img->thumbnail(width => 200, height => 200);
$thumb->write;
my $schema = Schema->connect('dbi:SQLite:db/Evangeline.db') or croak $!;
my $transaction = sub {
    my %table;
    foreach (qw/Image ImageTag Tag/) {
        $table{$_} = $schema->resultset($_);
    }
    foreach my $tag (@tags) {
        # XXX
        from_to($tag, $charset => 'UTF-8');
        #$table{Tag}->find_or_create({tag => $tag});
    }
};
eval { $schema->txn_do($transaction) };
if ($@) {
    # XXX            
}
File::Copy::move($src, $dest) or croak "$!" unless $self->_debug;
$self->say;
unlink $src if $self->_debug;

うー、なかなか進まない…