Archive for the ‘Linux’ Category

Perl DBI Last Insert ID

Recently I was re-searching for an Perl DBI corenspondent for PHP’s last_insert_id(), so here’s what I’ve found:

$dbh->do('INSERT INTO some_table ...');
my $id = $dbh->last_insert_id(undef, undef, qw(some_table some_table_id)) or die "can not get it?";

Another way:

my $id = $dbh->{ q{mysql_insertid}};

The two undefs are for catalog and schema which don’t appear to be necessary. The DBI docs say they can be ignored for MySQL so you might not even need the table and field parameters.

Unable to load Selinux Policy. Machine is in enforcing mode

Something that happened to me in the last days, after I’ve removed /etc/selinux 🙂

If you a get and boot error like :
“Unable to load Selinux Policy. Machine is in enforcing mode. Halting now. Kernel Panic!”

Boot with enforcing=0 at the grub boot menu [Edit the boot line to append ‘enforcing=0’].

Then once the system is up, edit /etc/grub.conf to include the appending.