2 ms·
(If you're a startup CTO type, why are you doing Perl 5?) Let's say you have InterestingObjects, a hash map from strings to objects. You could say Interestin
by lsb 18y ago
(If you're a startup CTO type, why are you doing Perl 5?)
Let's say you have InterestingObjects, a hash map from strings to objects. You could say InterestingObjects['foo'].andand['bar'].andand != '', but you might do better to rethink control flow, and reframe your problem, because there might be an easier way than always talking about variables that might not exist that have unknown properties. That looks like you're breaking encapsulation.
- rjurney 18y agoPerl 5 pays the bills :) Actually, I don't have a problem with Perl 5/Catalyst http://www.catalystframework.org/ http://www.catalystframework.org/ for a Startup, as long as you have several people quite good at it. If you know what you're doing, the main problem is finding good startupish Perl devs. I confess that I don't understand your example. I'm not breaking encapsulation, I'm just verifying that a variable is defined (avoids 'variable not defined, can't call can' error), that it is an object with the method of interest (avoids 'no such method' error), etc. In other words - I am doing a type check that its a valid object of the class I want with a non-null value on a field that should never be null. Happens all the time. This is more easily defined once in the class in a more reasonable object system. But Perl 5 without Moose has no such thing. Which would seem to parallel the article. I could just assume that $object->foo will work, but that doesn't work out too well as code grows, because if I want my code to work or at least to easily be fixed, I have to check sanity everywhere possible.