I'm trying to insert the right path to perl, lib path etc, when extracting a file during the plugin setup process. Here is the code I have:
$code =~ s,use lib '[^']+',use lib '$CFG->{admin_root_path}',;
$code =~ s,Links::init\(\),Links::init('$CFG->{admin_root_path}'),;
$code =~ s,Links::init_user\(\),Links::init_user('$CFG->{admin_root_path}'),;
The thing is, only the last two regex's work. The use lib one won't do as it's told :)
....is the default file I have:
use lib '';
use Links::init();
use Links::init_user();
....and after extraction I have:
use lib '';
use Links::init('/path/to/admin');
use Links::init_user('/path/to/admin');
I've used this code before and it works but I can't see why it doesn't this time
$code =~ s,use lib '[^']+',use lib '$CFG->{admin_root_path}',;
$code =~ s,Links::init\(\),Links::init('$CFG->{admin_root_path}'),;
$code =~ s,Links::init_user\(\),Links::init_user('$CFG->{admin_root_path}'),;
The thing is, only the last two regex's work. The use lib one won't do as it's told :)
....is the default file I have:
use lib '';
use Links::init();
use Links::init_user();
....and after extraction I have:
use lib '';
use Links::init('/path/to/admin');
use Links::init_user('/path/to/admin');
I've used this code before and it works but I can't see why it doesn't this time
