Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Ovid (2709)

  (email not shown publicly)
AOL IM: ovidperl (Add Buddy, Send Message)

Stuff with the Perl Foundation. A couple of patches in the Perl core. A few CPAN modules. That about sums it up.

Journal of Ovid (2709)

Tuesday November 15, 2005
06:41 PM


[ #27584 ]

You ever have days where where you stare at code that has absolutely nothing wrong with it and you try to figure out why it's not working?

eval { "use $factory_class" };

I blew about five minutes trying to figure that out. What's worse, it was throwing a warning, so I made that go away.

no warnings 'void';
eval { "use $factory_class" };

Yeah, real impressive coding there. Were it not for my test suite, that would have passed silently into production.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I stared at this for a while yesterday, wondering why I wasn't getting any output.
    %hash = ...;
    Dumper( \%hash );
    I actually make this mistake about once a week. For all the complaining I do about functions doing I/O on their own, I wish this one did.
    • use Data::Dumper::Simple autowarn => 1;

      my %hash = (
          foo => 1,
          bar => 'baz',
      %hash = (
        'bar' => 'baz',
        'foo' => 1

      Of course, that just led me to a bug in the docs which incorrectly identifies the attribute as autodump. I need to go fix that.

      Or, if you're like me and you set up editor bindings to spit out boilerplate quickly, then you won't mind this interface:

      use Data::Dumper::Simple

  • I just wasted days on one where MySQL told me I had a syntax error in my query, which I clearly didn’t. The problem was in $sth->execute( map $cgi->param( $_ ), @paramname ); – can you spot it?

    • Erm, not quite sure. Could it be a list context issue where you have list elements dropping out or extra elements getting inserted?

      • Exactly. I had to bung an extra scalar in there, à la

        $sth->execute( map scalar $cgi->param( $_ ), @paramname );

        I failed to see the problem for days even though I had done this correctly in every other instance of this snippet.