Subject: | Move option number check from has() |
Currently Moose::has() checks that it is is passed an even number of
arguments (i.e. a hash). This check does not belong there as has()
doesn't really care about those options. The earliest these matter is in
the Moose::Meta::Attribute constructors - new() and
interpolate_class_and_new().
The attached patch does two things:
1) Moves the option check to interpolate_class_and_new(). This means
there is no check inside new(), but it seems to be always called from
interpolate_class_and_new() during normal attribute construction.
2) Changes the error message since it is no-longer 'has'-specific. Also
I have always found the existing error message rather confusing, as it
does not tell me much about what the actual problem is.
The patch is probably fairly basic and probably should not be applied as
is, and probably needs more tests, but I would like to know if the
approach makes sense.
P.
Subject: | move_option_check.patch |
ÿþF r o m d 0 0 0 b a 7 5 1 e 9 9 4 c b 1 2 c 3 3 e f c 6 8 f 2 d e c 4 5 5 6 2 1 d 6 3 8 M o n S e p 1 7 0 0 : 0 0 : 0 0 2 0 0 1
F r o m : P e t e r S h a n g o v <