Allow Pass By Reference at the Script Level - pass-by-reference

I am trying to allow a few functions that are all contained in one script to pass by reference. I don't want to turn this on globally but when I add the following directive in the script where I want pass by reference, I still see the PHP warnings:
Deprecated: Call-time pass-by-reference has been deprecated
I was expecting to see those warnings go away after I overrode the PHP INI file.
ini_set("allow_call_time_pass_reference", "true");
How do I do this or is that correct and the warnings are there because the PHP interpreter is not parsing my local ini_set() directive only reading php.ini?

http://php.net/manual/en/ini.core.php : allow_call_time_pass_reference => PHP_INI_PERDIR
http://php.net/manual/en/configuration.changes.modes.php : PHP_INI_PERDIR => Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)
Answer: you can't set it with ini_set.
And if you will be using php 5.4.0, this configuration option has been removed.

Related

TOML how to have key without value

Many Python tools these days are using pyproject.toml as a config file, and mirror the tool's command line arguments with config file keys. Tools may have command line flags that are not passed any arguments:
sometool --some-flag
Now, I am trying to place this --some-flag into a pyproject.toml config file and can't figure out how to have a key without any value.
[tool.sometool]
# Both of the below are invalid
some-flag
some-flag =
In TOML, is it possible to have a key without a value?
This is not possible.
It'd depend on the tool how they are doing this, so please refer to their documentation. I would guess they are treating those flags as a boolean.
[tool.sometool]
some-flag = true

Using Config::Simple to read MySQL config file with keys without values

I try to configure my mySql config file with perl.
I use config::simple for doing this.
my code is:
#!/bin/perl
use Config::Simple;
$cfg = new Config::Simple('/etc/mysql/my.cnf');
$cfg->param('bind-address', '192.168.1.11');
$cfg->save();
the problem is that I get an error when a row only has a key and not an value to it. How do I fix this problem?
To extend simbabque's comment I would suggest using Config::MySQL to deal with MySQL config files.
Config::MySQL extends Config::INI to support reading and writing
MySQL-style configuration files. Although deceptively similar to
standard .INI files, they can include bare boolean options with no
value assignment and additional features like !include and
!includedir.

Export Library path & include in perl

I have a query with regards to exporting library path & include for Platypus variant caller. The htslib it requires and platypus are installed on the server and I don't have sudo permissions to change them.
I am trying the following code to export library & include for running the caller. Am i missing osmething because am not able to execute it?
Code:
#!usr/perl-w
use strict;
use warnings;
`export LIBRARY_PATH=/opt/htslib/lib/`;
`export LD_LIBRARY_PATH=/opt/htslib/lib/`;
`export INCLUDE_PATH=/opt/htslib/include/`;
system ("python /opt/Platypus_0.8.1/Platypus.py callVariants --help");
Any sort of help would be appreciated.
You're setting the env vars of freshly-made shells, not of the Perl process that is to parent python. For that, you need the following:
$ENV{LIBRARY_PATH} = '/opt/htslib/lib/';
$ENV{LD_LIBRARY_PATH} = '/opt/htslib/lib/';
$ENV{INCLUDE_PATH} = '/opt/htslib/include/';
The last line of your code is better written as follows, since it avoids a needless shell:
system("python", "/opt/Platypus_0.8.1/Platypus.py", "callVariants", "--help");

VIM: FileType specific mapping not working when defined in ftplugin

I am trying to set a mapping for FileType perl. The mapping is for the case when I forgot to use semicolon at the end of the line.
So first I tried adding in my .vimrc autocmd! FileType perl nnoremap <leader>; $a;<esc> and it worked fine but than I thought of using ftlugin/perl.vim .
So I added the below line in my corresponding ~/.vim/after/ftplugin/perl.vim
nnoremap <buffer> <leader>; $a;<esc>
but it didn't work.
Any idea why it is not working ?
My perl version is perl 5, version 14.
Try putting the file in ~/.vim/ftplugin/perl.vim instead of ~/.vim/after/ftplugin/perl.vim. From :help after-directory:
*after-directory*
4. In the "after" directory in the system-wide Vim directory. This is
for the system administrator to overrule or add to the distributed
defaults (rarely needed)
5. In the "after" directory in your home directory. This is for
personal preferences to overrule or add to the distributed defaults
or system-wide settings (rarely needed).
From :help ftplugin:
If you do want to use the default plugin, but overrule one of the settings,
you can write the different setting in a script: >
setlocal textwidth=70
Now write this in the "after" directory, so that it gets sourced after the
distributed "vim.vim" ftplugin |after-directory|. For Unix this would be
"~/.vim/after/ftplugin/vim.vim". Note that the default plugin will have set
"b:did_ftplugin", but it is ignored here.
One thing I just noticed that was driving me crazy: <buffer> must be lowercase! Out of habit, I uppercase all of my <BRACKET> prefixes... and I had done the same for <BUFFER>. None of my ftplugin mappings worked and I couldn't figure it out... until I wasted hours trying different things, only to find that it must be lowercase <buffer>.

scripting buildroot configuration file

I am trying to switch between external and internal build via some export variable in a script. I am able to do this partially meaning for bool values but for those which take in strings how to tell buildroot to continue with default value and not prompt for values to the user.
For e.g., BR2_TOOLCHAIN_EXTERNAL_STRIP=y works fine, as it takes in bool value, but BR2_TOOLCHAIN_EXTERNAL_PATH prompts for a value, even though default is set to the correct path.
Thanks for any help
If you want to switch easily between internal and external toolchain builds, then I would suggest creating fragments of defconfig files:
One defining the internal toolchain configuration
One defining the external toolchain configuration
One defining the common options
And then, you just to :
cat internal-toolchain.config common.config > configs/myown_defconfig
make myown_defconfig
and there you are. And similarly with external-toolchain.config.