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

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.
  • What I don’t see is why you picked closure-based objects?

    As for the package-per-instance approach, that works, but the packages never get garbage-collected unless you do that manually, which is tricky to get right in the best of cases, and I think deleting packages has some gotchas anyway.

    As for can, you know that it’s just a method, right? Assuming you use the first approach that relays through a dispatch table rather than the one where you create packages:

    sub can {
        my $self

    • As for why closure based objects, so that I didn't have to go through and change all of the thousands of variables to be $self{var} or $self->{var} or the like instead of $var.

      As for AUTOLOAD, that's a good point (redefining can). I'm not sure what I was thinking in just not doing that. But it's about the same amount of code either (mucking with the symbol table to redispatching with AUTOLOAD), and I like the idea of not having to go through AUTOLOAD for each hit.

      I'm probably going to be moving a lot o
      • Does the expense of going through AUTOLOAD really matter? Because it’s most definitely not the same amount of code, qualitatively speaking. The package-based code is a lot more conceptually complex, and has much more tangible problems than the overloaded can method (defies garbage collection vs. slows method calls down a tad).

        As for just changing the scope: what do you mean? I don’t quite understand that statement.

  • It’s really easy to go into code that has cut-and-paste-itus and try to clean it up and just utterly fail because you start fixing one thing, get distracted and start fixing another thing, and so on and so forth.

    Yeah. Unraveling a ball of mud is an art. A painful, slow and proportionally unrewarding art, but an art nonetheless.

    I feel like I’ve successfully decoupled logic and data to a large degree. Does the end justify the means? ;)

    As I opined before, yes it does, as long as the end is