Snap daemon fails when launching pg_dump

The yorokobi snap has a yorokobi.daemon that fails when it tries to backup a database using pg_dump.

This is the exception log:

2019-02-28 18:23:47,720 - yorokobi - INFO - End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0x7f5b56c12da0>
command: /snap/yorokobi/209/usr/bin/pg_dump
args: ['/snap/yorokobi/209/usr/bin/pg_dump', '-Fc', '--host=localhost', '--port=5432', '--username=postgres', '--password', 'shakespeare']
buffer (last 100 chars): b''
before (last 100 chars): b'pg_dump line 22.\r\nBEGIN failed--compilation aborted at /snap/yorokobi/209/usr/bin/pg_dump line 22.\r\n'
after: <class 'pexpect.exceptions.EOF'>
match: None
match_index: None
exitstatus: 2
flag_eof: True
pid: 5341
child_fd: 20
closed: False
timeout: None
delimiter: <class 'pexpect.exceptions.EOF'>
logfile: None
logfile_read: None
logfile_send: None
maxread: 2000
ignorecase: False
searchwindowsize: None
delaybeforesend: 0.05
delayafterclose: 0.1
delayafterterminate: 0.1
searcher: searcher_re:
    0: re.compile(b'Password')

This error is happening somewhere at this point:

If I look into the pg_dump file at the line described in the error I can see it is requiring these two modules:

use POSIX;        #line 21
use PgCommon;     #line 22

Im stuck here as I can’t edit the pg_dump file to further debug (its mounted as read-only by snap).

PgCommon is located at /snap/yorokobi/209/usr/share/postgresql-common so I binded it, but still I get the same error.

layout:
  /usr/share/postgresql:
    bind: $SNAP/usr/share/postgresql
  /usr/share/postgresql-common:
    bind: $SNAP/usr/share/postgresql-common

Any idea what is causing this or how to continue debugging from this point?

Bumping this. Any idea?

is the snap including all the perl modules it needs?

I listed perl and perl-base in stage-packages. Is there anything else that I am missing?

you need to mangle the module import path for perl somehow in the environment, else it wont find its modules (if your script uses any)