1) I don't understand this piece of code in Mojo/Base.pm:
63: $class = ref $class || $class;
because of it now I have to write something like this in every child package
sub setup_meta_class {
croak 'First arg must be a class name' if ref $_[0];
# ...
}
to avoid incorrect usage
may be it is better to add /croak '' if ref $class/ to Mojo::Base?
2) About my previous mail. I still think, it is better to add my patch
or maybe add
/croak '...' unless ref $_[0] eq 'HASH'/
to evaluated $code in Base.pm
Why? Because in spite of your answer, calling accessors on classes
instead of
instances is supported now, but incorrect.
And now it is easy to confuse $object->method with $class->method. So,
it is better to decide unequivocally,
does Mojo::Base support $class->accessor or not, to avoid problems in
the future
P.S.
Sorry for my English
I would disagree with changing the behavior of Mojo::Base. IMO, Mojo should assume a certain level of perl competence from the programmer. Trying to protect programmers from bad habits should not be the job of Mojo. Of course, everything is subjective, but I see no compelling reason to change the behaviour of Mojo::Base based on the discussion above.
--
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mojolicious/-/HIncr61vA6wJ.
To post to this group, send email to mojol...@googlegroups.com.
To unsubscribe from this group, send email to mojolicious...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mojolicious?hl=en.