|Subject:||feature request: direct command to use the perlbrew configuration for the given user|
Currently, the only automatic way to access a perlbrew environment is to use a login shell for that user, which is not doable for system processes and daemons, which are frequently started up as another user and then the uid is switched. There needs to be a way of saying "initialize the perlbrew environment for this user" directly through the perlbrew executable, rather than depending on bash scripts which are executed indirectly via the shell. Here's a usecase I'm starting to run into frequently: I start up a process as the root user (e.g. /etc/init.d/my_service start). I don't want root to be using anything but the system perl, so this process doesn't know anything about perlbrew. This service is going to change its uid and exec another process - which is my service that runs under a perlbrew available to that user. We need to have access to that user's $PATH (including the perlbrew paths) in order to even find this service... Right now, I'm doing this: "exec bash -c source /home/$NEWUSER/.perlbrew/init && source $PERLBREW_ROOT/etc/bashrc && my_real_program". (Where my_real_program is in a perlbrew bin directory). However, this is dependent on internal details to perlbrew (knowing where and how it stores its configuration), which I think is too fragile. What would be much nicer is: "exec perlbrew run --user $NEWUSER my_real_program", or perhaps "exec bash -c perlbrew reinit && my_real_program" - which would initialize the perlbrew environment for the current uid (NOT $USER, as that value is not correct - it's still "root"!) and then run the program.