Well, that does what you think it does, probably. If the object you're trying to determine the truth of is defined, then this will return a true value, and the Vector2D will thus be considered true.
However, consider for a moment under what circumstances this will return false.
defined() returns false only if it's argument is undef. However, undef isn't-a Vector2D, so your bool() function will never get called on undef.
You method, in other words, is equivilent to sub bool {return 1;} (golfers note: in all of these examples, the return and semicolon are optional. I find that confusing, so don't use it.).
Think about what the semantics of truth for a Vector2D are, then write your function.
(BTW, I don't mean for this to sound snippy or anything, I'm just in a kind of off mood.)
TACCTGTTTGAGTGTAACAATCATTCGCTCGGTGTATCCATCTTTG ACACAATGAATCTTTGACTCGAACAATCGTTCGGTCGCTCCGACGCIn reply to Re: Re: Re: Re: Re: Operation `bool': no method found, argument in overloaded package Vector2D at
by theorbtwo
in thread Operation `bool': no method found, argument in overloaded package Vector2D at
by rbc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |