Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

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.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://373666]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2018-02-24 12:59 GMT
Find Nodes?
    Voting Booth?
    When it is dark outside I am happiest to see ...

    Results (310 votes). Check out past polls.