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.
  • Class::Accessor has the advantage that it doesn't abuse import() to do something other than importing just to get a more compact syntax.
    • Does it matter?

      In fact, since O::T creates accessors with the given names, it’s arguable whether it’s even abuse in the first place.

      • I find it unnecessarily confusing to use import for non-importing tasks. It's usually done only as syntactic sugar, not because it actually needs to happen at that stage. It's not a huge problem, but I appreciate the fact that modules like Test::More let's me use a more traditional alternative syntax.
        • What about pragmas, like strict? use strict qw(refs); Would you prefer use strict; BEGIN { strict->enable(qw(refs)) } Imports seem like a general way to parameterize the use of a module. The historical choice of the name import() shouldn't necessarily be taken as a permanent restriction on usage.
          • As an actual pragma, strict is kind of a special case. It also has an actual need to get the information at compile time, unlike many uses of import which would work fine with a standard sub call. I'd still prefer it if strict didn't look it was about to create a sub called "refs", but it's kind of too late now.
            • I like the idea of generating the accessors at compile time. In that regard, is is a lot like importing.
          • Well, since strict "refs" is lexically scoped, there is no BEGIN { } equivalent possible (see the block there?). Perhaps use constant is a better example.