[SR-Users] how to evaluate a string value?

Iñaki Baz Castillo ibc at aliax.net
Sun Jun 27 00:30:19 CEST 2010


2010/6/26 Juha Heinanen <jh at tutpro.com>:
> http_query function takes an url as the first argument, for example,
>
> http_query("http://localhost/test.php?uri=$(ru{s.escape.param})",
>        "$var(result)");
>
> what i would like to do is this:
>
> http_query("$sel(cfg_get.local.http_query_url)", "$var(result)");
>
> that is, instead of giving url argument as a fixed string, i would like
> to take it from cfg variable.
>
> the problem is that if i give local.http_query_url string value
> "http://localhost/test.php?uri=$(ru{s.escape.param})", pseudo variables
> and transformations in the value are not evaluated.
>
> is there any current means to get them evaluated?  something like
>
> http_query(eval("$sel(cfg_get.local.http_query_url)"), "$var(result)");
>
> ????

Same occurs when setting a pv containing another pv and trying to use
the resulting pv into xlog function. A workaround is generating the
new pv with concatenations:

- This doesn't work as expected:

  $var(final_string) = "$rU at something";
  xlog("L_INFO", "final string = $var(final_string)\n");
  => final string = $rU at something

- This works as expected:

  $var(final_string) = $rU + "@something" + .... ;
  xlog("L_INFO", "final string = $var(final_string)\n");
  => final string = 12345678 at something


However this is not the same case as yours...

-- 
Iñaki Baz Castillo
<ibc at aliax.net>



More information about the sr-users mailing list