in reply to LibXML and %ENV in 5.18 on Windows

I'm guessing this maybe unicode related, try adding

my $name = $attr->getValue(); use Devel::Peek; Dump($name); $name = Encode::encode( 'latin1', $name ); Dump($name);

or just

my $name = $attr->getValue(); $name = substr($name,0);
poj

Replies are listed 'Best First'.
Re^2: LibXML and %ENV in 5.18 on Windows
by gweekly (Novice) on Jan 23, 2017 at 17:39 UTC
    It is interesting to note that a Devel::Peek::Dump done in 5.16 also shows UTF8, but 5.16 does not have the problem that 5.18 does.
    C:\Users\gweekly>c:\ActivePerl5.16.3\bin\perl -d i:\bin\badperl
    
    Loading DB routines from perl5db.pl version 1.37
    Editor support available.
    
    Enter h or 'h h' for help, or 'perldoc perldebug' for more help.
    
    main::(i:\bin\badperl:16):          if grep { /^ SAM $ /xmsi} keys %ENV;
    
      DB<1> c 27
    main::(i:\bin\badperl:27):      my $fixed = substr "X$name", 1; # Should be the
    same
    
      DB<2> use Devel::Peek
    
      DB<3> Dump $name
    SV = PVNV(0x2cc711c) at 0x2a27314
      REFCNT = 2
      FLAGS = (PADMY,POK,pPOK,UTF8)
      IV = 0
      NV = 0
      PV = 0x2d6614c "SAM"\0 UTF8 "SAM"
      CUR = 3
      LEN = 12
    
      DB<4> q
    
    C:\Users\gweekly>c:\ActivePerl5.18.1\bin\perl -d i:\bin\badperl
    
    Loading DB routines from perl5db.pl version 1.39_10
    Editor support available.
    
    Enter h or 'h h' for help, or 'perldoc perldebug' for more help.
    
    main::(i:\bin\badperl:16):          if grep { /^ SAM $ /xmsi} keys %ENV;
    
      DB<1> c 27
    main::(i:\bin\badperl:27):      my $fixed = substr "X$name", 1; # Should be the
    same
    
      DB<2> use Devel::Peek
    
      DB<3> Dump $name
    SV = PVMG(0x2f14534) at 0x2bfd924
      REFCNT = 2
      FLAGS = (PADMY,POK,pPOK,UTF8)
      IV = 0
      NV = 0
      PV = 0x2f730d4 "SAM"\0 UTF8 "SAM"
      CUR = 3
      LEN = 12
    
      DB<4>
    
Re^2: LibXML and %ENV in 5.18 on Windows
by gweekly (Novice) on Jan 23, 2017 at 14:25 UTC
    This is very helpful. Thank you! Any idea if this has been (or should be) reported as a BUG?
        Thank you.
        That page indicates v5.16.0 took an approach (assumes byte strings) that seems to work for me.
        My quandary is wondering why 5.18 then stops working for me.
        It SEEMS to me like a bug was introduced in 5.18.
        Could anyone look into this possibility (using my code as the test case)?
        Thanks!