user-pic

Gábor Szabó - גאבור סבו

  • Posted YAPC::EU - over 200 participants to Gábor Szabó - גאבור סבו

    YAPC::EU Granada has just passed 200 confirmed participants already passing two previous YAPC::EUs and there is still more than a month to go.

    YAPC::NA in Salt Lake City gained mo…

  • Subscribe to feed Recent Actions from Gábor Szabó - גאבור סבו

    • BooK commented on A widespread and broken Perl idiom

      To be conviced of how widespread the technique is, just check: https://grep.metacpan.org/search?q=local.*@ARGV

    • Aristotle commented on A widespread and broken Perl idiom

      I became aware of this as far back as my PerlMonks days, so at least 15 years ago. Namely, I memorised that I should be writing the idiom like this:

      my $content = do { local ( *ARGV, $/ ) = [ ... ]; <> };

      This differs from the incorrect version by exactly 3 character swaps.

    • Damian Conway commented on A widespread and broken Perl idiom

      Sadly, this elegant approach doesn't solve the original problem.

      typeglob only localizes the slot being assigned to. The rest of the typeglob remains unlocalized, which means the magic <> still messes up the global $ARGV and the global *ARGV{IO} filehandle.

      For example:

      sub report_ARGV {
          use Data::Dump 'pp';
          say shift;
          say '  $ARGV       = ', pp $ARGV;
          say '  @ARGV       = ', pp @ARGV;
          say '  %ARGV       = ', pp %ARGV;
          say '  *ARGV->tell = ', *ARGV->tell;
      }
      …
    • Aristotle commented on A widespread and broken Perl idiom

      Oh, wow.

      I had to go all the way to

      $_ = [ __FILE__ ] for local *ARGV;

      to make it work in a single statement. Even something like

      *{ \local *ARGV } = [ __FILE__ ];

      wouldn’t work, despite the fact that circumfix deref is effectively a do { } block with a whole separate inner scope (e.g. *{ my $x = 'hi'; local \*ARGV } = [ __FILE__ ]; say $x; is a strict vars violation).

      I don’t think local is that super-intelligent, which means what’s going on must be something like …

    • Dave Cross commented on Progress of blogs.perl.org grant

      Yes. The current implementation is using a long-unsupported version of Movable Type, with no upgrade path available to us. The site has a number of problems (some annoying and some critical) that we have been unable to fix.

      This is the second project to replace that code with a new implementation based on PearlBee. The project is sponsored by The Perl Foundation and is being worked on by Andre at Booking.com.

    Subscribe to feed Responses to Comments from Gábor Szabó - גאבור סבו

    About blogs.perl.org

    blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.