in reply to search and replace regex return value

The issue is visible on perl 5.22.0, Tk 804.033 running in CentOS 6.8. Based on the fact that older version gives "correct" result I can only assume that I have a faulty version and I'll need to update to latest available and see if it fixes the issue.

  • Comment on Re: search and replace regex return value

Replies are listed 'Best First'.
Re^2: search and replace regex return value
by LanX (Saint) on May 07, 2017 at 14:15 UTC
      Could it be a blessed object or something else?

      I think the AM post is onto something, Devel::Peek shows that $CFG{target} has some magic of type PERL_MAGIC_uvar attached to it. Not being a Tk expert I can only guess that the magic is probably necessary to bind the value to the widget, but the fact that this causes $CFG{target} =~ ... to behave differently than usual smells like a bug to me. But if the app needs to work on a range of Tk versions, it looks like the workaround might be necessary.

        OK but

        > Workaround is simple  my $target = $CFG{target} ;

        Might not be enough in order to loose special flags.

        I'd cast explicitly to get a new value

         my $target = "" . $CFG{target} ;

        Unfortunately I can't test at the moment.

        Cheers Rolf
        (addicted to the Perl Programming Language and ☆☆☆☆ :)
        Je suis Charlie!

Re^2: search and replace regex return value
by milma (Initiate) on May 07, 2017 at 20:36 UTC

    The problem does not exist with perl version 5.24.1 and also the workaround

    my $target = $CFG{target} ;

    resolves the issue in version 5.22, so I have alternative ways to resolve my issue. Thanks for your help.