Bot-BasicBot-Pluggable
view release on metacpan or search on metacpan
bin/bot-basicbot-pluggable-infobot-upgrade view on Meta::CPAN
#!/usr/bin/perl
use warnings;
use strict;
use Storable qw(retrieve nstore);
use File::Copy qw( cp );
unless (-e "Infobot.storable") {
die "I can't see Infobot.storable in ./\n";
}
if (-e "Infobot.storable.backup") {
die "There's already a backup of Infobot.storable in ./\n";
}
cp("Infobot.storable", "Infobot.storable.backup")
or die "Can't back up Infobot.storable: $!\n";
unless (-s "Infobot.storable" == -s "Infobot.storable.backup") {
die "Infobot.storable backup isn't the same size!\n"
}
my $data = retrieve("Infobot.storable")
or die "Can't load Infobot.storable for some reason\n";
my $new;
warn "converting...\n";
for my $factoid (keys %{ $data->{infobot} }) {
$new->{ "infobot_$factoid" } = delete $data->{infobot}{$factoid};
}
( run in 1.271 second using v1.01-cache-2.11-cpan-49f99fa48dc )