Closed Ovid closed 10 years ago
That is not a syntax error because it is valid syntax. The default value is not evaluated until object construction, which is why you are seeing the delay. And when you try and construct the object, it is calling the ro
subroutine (cause that is what traits are after all) with no arguments, which results in the error you are seeing (because traits expect a meta object as their first argument).
Only real way to solve this is to improve the error checking in the ro
trait so that it handles undefs.
This provides a slightly better error message now. Not sure if there's anything more we want to do here.
I'm unsure exactly what error we have here, but consider the following:
That prints "this", followed by "Can't locate object method 'test'...". That's because we're assigning a bareword to
$!test
, but in reality it's thero
trait. If we changero
tofoobar
, we get the expected bareword error.If we call the constructor without args, the above returns:
This is version .03 of the mop.
Cheers, Ovid