in reply to Re: Newbie OO module-structure question
in thread Newbie OO module-structure question

Nice!

... but can you introspect the tasks with My::Task role, in order to DRY°?

update

In other words, is it possible to loop over all classes which have a role instead of hardcoding it at the end?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

°) don't repeat yourself

update

fixed auto-correction: s/introspective/introspect/

Replies are listed 'Best First'.
Re^3: Newbie OO module-structure question
by choroba (Cardinal) on Apr 30, 2019 at 09:49 UTC
    I don't see any loop over classes. There's a loop over objects.

    If you don't like the constructors of the particular TaskN objects, that's what I'd solve with a factory.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
      > If you don't like the constructors of the particular TaskN

      I didn't say I don't like it, I was asking if it's possible to get a list of all classes having a specific role.

      Probably too far fetched for Moo.

      > that's what I'd solve with a factory.

      Good point!°

      On a side note ...

      Could you please write an OO book for languages with dynamic typing?

      I'm tired of the cognitive dissonance caused by Java concepts. ;D

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      °) the OP is so wishy washy that I was thinking in another direction

Re^3: Newbie OO module-structure question
by karlgoethebier (Abbot) on Apr 30, 2019 at 11:17 UTC
    "...in order to DRY...have a role instead of hardcoding...

    Insisting so much on DRY is sometimes remote from everyday life. Because RY is human nature. Why? Remember how often your parents, siblings, aunts, uncles, spouses, colleagues, fellow monks etc. told you to become a better person. In the long run they have been successful. Sometimes WET is better. Or faster - as you like.

    «The Crux of the Biscuit is the Apostrophe»

    perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

      Is it already time to miss s*nd*l?

      So soon ... ;-P

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery FootballPerl is like chess, only without the dice