Stories
Slash Boxes
Comments
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.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Hi, regarding

    Further, Object::Tiny lets you pass your params in directly, without having to wrap them in an additional HASH reference that will just be copied ANYWAY inside the constructor.

    and

    Object::Tiny accessors are identical in speed to Class::Accessor::Fast accessors, but Object::Tiny constructors are TWICE as fast as Class::Accessor::Fast constructors, DESPITE C:A:Fast forcing you to pass by reference (which is typically done for speed reasons).

    Speed is not the only reason, and I believe its no

    --
    life is short
    • ..the error message from perl will tell me the exact
            line number where I made the mistake, and not the line inside your
            constructor where you assign @_ to an hash (the common approach).

      That's what Perl Best Practices recommends too, I think,
      although it looks terrible.
      • Yes it is... As for the syntax, it grows on you.

        But truth be told, there is no need to use that trick to get the proper error line. If module authors that accept hashes add this line:

            croak('FATAL: odd number of parameters, ') if @_ % 2;

        (Use Carp qw( croak ) at the top also)

        It would also work.

        Best regards,
        --
        life is short