in reply to Re: What is this Moose mojo?
in thread What is this Moose mojo?

All right then... (damn! that was quick!) :-D ... we still seem to have an attribute and a sub that are both named “fif.”

Why is there not a conflict with regard to the without an underscore name? Don't we now have a method-name and an attribute-name that are identical? If I now say “$foo->fif,” (no underscore...) what happens ... and why?

Does the author ... intend ... to first set-up the has declaration, i.e. “just to create the accessor,” and then to immediately supersede it with his own sub? (Blink...) If so, why??

Replies are listed 'Best First'.
Re^3: What is this Moose mojo?
by zwon (Abbot) on Feb 04, 2009 at 22:51 UTC
    Does the author ... intend ... to first set-up the has declaration, i.e. “just to create the accessor,” and then to immediately supersede it with his own sub? (Blink...) If so, why??

    It seems author doesn't want you be able to read password fields using $foo->fif (but you still can read them using $foo->_fif).

    Update: Uhm... if it's boolean, then why it's called password?

    =head2 password This is a boolean flag to prevent the field from being returned in the C<$form->fif> and C<$field->fif> methods. =cut has 'password' => ( isa => 'Bool', is => 'rw' );
Re^3: What is this Moose mojo?
by kyle (Abbot) on Feb 04, 2009 at 22:44 UTC

    If you say "$foo->fif", the fif method is called. The "fif" attribute is stored as "$foo->{fif}".