user-pic

Toby Inkster

Subscribe to feed Recent Actions from Toby Inkster

  • Yuki Kimoto commented on The way to create Class with only Perl core language.

    Everyone, Do you understand my OO code is for users which can't install modules into their server?

    Do you think this is good code for them?

    I also want to hear good points about my code, adding to negative points.

  • byterock commented on The way to create Class with only Perl core language.

    This was standard early way to do things from many years ago. 1980~90s. Now days we would call it Old Shcool.

    https://www.perl.com/article/25/2013/5/20/Old-School-Object-Oriented-Perl/

    I have had to do above in so called closed systems some time ago even wrote a module(Orignal) to help me out is such situations.

    If I had to work on such a closed system today with and it had up to date perl I would go with Class::Struct as that is part of core

  • Konstantin Uvarin commented on namespace::local: hiding utility functions in moo[se] roles

    Sure, but that's not so funny!

    Also it means private functions must be above the public ones, although who cares about the order anyway...

  • ysth commented on Is there anything wrong with this benchmark?

    I believe Toby is right, and the sub created by around will not recognize any later changes to the inheritance (or redefining of the original sub), which obviously makes it more efficient - as long as you are not making such changes.

  • Grinnz commented on Is there anything wrong with this benchmark?

    With ->SUPER, your sub is being called first and then it looks up what the superclass is via inheritance. With around, it *creates a new sub* in place and then passes you (at call time) a reference to the previously existing sub, or the method that would have been inherited at the time of 'around'. You're right that later changes to inheritance would not be recognized (changing inheritance at runtime seems like a bad idea in general) but redefining the sub itself would override the 'around' completely since it already installed into that name, so that wouldn't be useful either.

Subscribe to feed Responses to Comments from Toby Inkster

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.