Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Is "ref($class) || $class" a bad thing?

by kscaldef (Pilgrim)
on Jul 12, 2004 at 17:19 UTC ( #373666=note: print w/ replies, xml ) Need Help??


in reply to Re: Is "ref($class) || $class" a bad thing?
in thread Is "ref($class) || $class" a bad thing?

The point, such as it is, is that in order to cover all three possible evaluations of the conditional, you have to make that meaningless call. This, of course, sucks. Now, probably the answer is that 100% code coverage isn't always possible or desirable.

On the other hand, I've seen large (hundreds of classes) systems where every constructor included ref $class || $class, and nowhere was any of them ever called using an existing instance. So, that's just silly.

If you never use the constructor in this way, you might as well just drop it. As a minor side-effect, you get your code coverage a little higher, and maybe that makes your manager happy or something.


Comment on Re^2: Is "ref($class) || $class" a bad thing?
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373666]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (12)
As of 2014-09-02 13:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls