What is happing if you write "$LETTERS{$letter}", i.e. us quotes instead of 
eval?



Regards



Gerald



Von: Chuck Zumbrun [mailto:chuck.zumb...@gmail.com]
Gesendet: Dienstag, 17. September 2019 17:22
An: embperl@perl.apache.org
Betreff: embPerl and Readonly module issue



Using embPerl 2.5.0, porting an application from Ubuntu 12.04, perl 5.14, 
Readonly 2.0.0 to Ubuntu 18.04, perl 5.26, Readonly 2.05



If I have a Readonly hash like this:



    [-
      use Readonly;

      Readonly our %LETTERS => {
        "A" => "Letter A",
        "B" => "Letter B",
        "C" => "Letter C"
      }
    -]


and I try to use it like this:


    [$ foreach $letter (keys %LETTERS) $]
      [+ $LETTERS{$letter} +]
    [$ endforeach $]



That works with the older versions and doesn't with the newer.  With the 
newer version nothing is output.  If I do something to force it to be 
evaluated, like:



   [$ foreach $letter (keys %LETTERS) $]
      [+ eval { $LETTERS{$letter} } +]
    [$ endforeach $]



It does output "LETTER A", etc. in both versions.



Any explanation of what's happening or suggestions on how to best deal with 
it?








-- 
This message has been checked by Libra Esva and is found to be clean.
Mark it as spam 
<http://srvmailgw3.i.ecos.de/cgi-bin/learn-msg.cgi?id=D925740090.A4277>
Blacklist sender 
<http://srvmailgw3.i.ecos.de/cgi-bin/learn-msg.cgi?blacklist=1&id=D925740090.A4277>

Reply via email to