perlsqliteubuntu-14.04padre

Padre complains about an SQLite database issue


I am starting with perl and wanted to install the IDE Padre on Ubuntu 14.04. The answers in this question indicate that I simply can use apt-get:

sudo apt-get install padre

I also tried to install it with:

sudo cpan Padre

as indicated here.

However, when I run padre, it gives me the following error:

DBD::SQLite::db selectall_arrayref failed: attempt to write a readonly database at (eval 1905) line 41.
Perl exited with active threads:
    1 running and unjoined
    0 finished and unjoined
    0 running and detached

And when I run it as root (sudo padre):

DBD::SQLite::db do failed: Safety level may not be changed inside a transaction at (eval 1905) line 37.
Perl exited with active threads:
    1 running and unjoined
    0 finished and unjoined
    0 running and detached

padre --version shows me: Perl Application Development and Refactoring Environment 1.00, and my perl version is 5.18.2.

In the /usr/bin/padre script I do not see any reference to an SQLite database. Does anyone know how I can solve this issue?


Solution

  • Finally I found the solution in this bug report. In the file Locker.pm (in my system located in /usr/share/perl5/Padre) the following function (line 102) should be changed:

    sub db_increment {
        my $self = shift;
        unless ( $self->{db_depth}++ ) {
            Padre::DB->begin;    
            # ...
            Padre::DB->pragma( synchronous => 0 );
        }
        return;
    }
    

    to:

    sub db_increment {
        my $self = shift;
        unless ( $self->{db_depth}++ ) {
            #...
            Padre::DB->pragma( synchronous => 0 );
            Padre::DB->begin;
        }
        return;
    }
    

    i.e. changing the order of Padre::DB->pragma and Padre::DB->begin.

    This allowed me to start padre as root (sudo), and to fix this I had to change the owner of the Padre configuration. I changed the rights to my user using chown:

    sudo chown -R myuser:myuser /.local/share/.padre/