go ahead... be a heretic | |
PerlMonks |
Moose handling of unwanted parametersby glasswalk3r (Friar) |
on Dec 19, 2016 at 23:06 UTC ( [id://1178136]=perlquestion: print w/replies, xml ) | Need Help?? |
glasswalk3r has asked for the wisdom of the Perl Monks concerning the following question: Hello fellow monks, This post could be named "OOP designing with Moose tip", but that depends the way you see it. I have a project of mine that I use Moose and I decided to separate connection parameters from the classes that need them, and create a separated class for it. Whenever those classes need to actually connect to something, the corresponding method request a connection instance passed as parameter. This seems to be working well. Things get fishy when I noticed a unit test that I was expecting to fail indeed did not. I'm still creating instance of those classes and passing connection parameters that they do not require anymore. Moose silents discard those parameters and move on. Since this particular unit test does not invoke a method that requires a connection, everything "works", until the object are actually used, that's it. It became a time bomb that I need to deactivate... So, the question is: am I using Moose properly? My design has a flaw? My unit test is not complete (I think it is not, although the connection might be considered a integration test)? Thanks!
Alceu Rodrigues de Freitas Junior --------------------------------- "You have enemies? Good. That means you've stood up for something, sometime in your life." - Sir Winston Churchill
Back to
Seekers of Perl Wisdom
|
|